From: jason Date: Tue, 15 Mar 2016 19:37:37 +0000 (+0000) Subject: PR c++/70095 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=25dea9abbf4ce91ba740dd5c8b7c9c2f603861b0;p=thirdparty%2Fgcc.git PR c++/70095 * pt.c (instantiate_decl): Fix call to variable_template_p. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234231 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9ace01eddbaa..eff989b160fe 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2016-03-15 Jason Merrill + PR c++/70095 + * pt.c (instantiate_decl): Fix call to variable_template_p. + PR c++/70141 * pt.c (for_each_template_parm_r): Always walk into TYPENAME_TYPE. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 724d6e994413..e8cfb660ad06 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -21935,7 +21935,7 @@ instantiate_decl (tree d, int defer_ok, if (enter_context) pop_nested_class (); - if (variable_template_p (td)) + if (variable_template_p (gen_tmpl)) note_variable_template_instantiation (d); } else if (TREE_CODE (d) == FUNCTION_DECL && DECL_DEFAULTED_FN (code_pattern)) diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ50.C b/gcc/testsuite/g++.dg/cpp1y/var-templ50.C new file mode 100644 index 000000000000..138a39971229 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ50.C @@ -0,0 +1,11 @@ +// PR c++/70095 +// { dg-do link { target c++14 } } + +template struct Foo; +template int variable_template = 0; +template int variable_template> = 0; +template int get_variable_template() { return variable_template; } + +int main() { + get_variable_template>(); +}