From d1ccf407dad8237e32c2d5a2d121dbd9c53483c7 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 15 Mar 2016 15:37:37 -0400 Subject: re PR c++/70095 ([C++14] Link error on partially specialized variable template) PR c++/70095 * pt.c (instantiate_decl): Fix call to variable_template_p. From-SVN: r234231 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/pt.c | 2 +- gcc/testsuite/g++.dg/cpp1y/var-templ50.C | 11 +++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/var-templ50.C (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9ace01e..eff989b 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 724d6e9..e8cfb66 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 0000000..138a399 --- /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>(); +} -- cgit v1.1