diff options
author | Jason Merrill <jason@redhat.com> | 2016-03-15 15:37:37 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2016-03-15 15:37:37 -0400 |
commit | d1ccf407dad8237e32c2d5a2d121dbd9c53483c7 (patch) | |
tree | 158e4c1a20e9af8176b5870a6d0a4101065f138a | |
parent | d4db81a27316cedfa66f33615866e0f2364f329e (diff) | |
download | gcc-d1ccf407dad8237e32c2d5a2d121dbd9c53483c7.zip gcc-d1ccf407dad8237e32c2d5a2d121dbd9c53483c7.tar.gz gcc-d1ccf407dad8237e32c2d5a2d121dbd9c53483c7.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/pt.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/var-templ50.C | 11 |
3 files changed, 15 insertions, 1 deletions
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 <jason@redhat.com> + 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 <typename T> struct Foo; +template <typename T> int variable_template = 0; +template <typename T> int variable_template<Foo<T>> = 0; +template <typename T> int get_variable_template() { return variable_template<T>; } + +int main() { + get_variable_template<Foo<int>>(); +} |