diff options
author | Jason Merrill <jason@redhat.com> | 2015-04-01 12:36:50 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2015-04-01 12:36:50 -0400 |
commit | f87cb0b73403b26113c52b5efa70e93332053dfe (patch) | |
tree | c4045299b6a3308d084117e00e7b13fdbbabf71c /gcc | |
parent | b6dd42a9a8ec56b5badc59c78f69760048914da4 (diff) | |
download | gcc-f87cb0b73403b26113c52b5efa70e93332053dfe.zip gcc-f87cb0b73403b26113c52b5efa70e93332053dfe.tar.gz gcc-f87cb0b73403b26113c52b5efa70e93332053dfe.tar.bz2 |
re PR c++/65646 (ICE in invalid syntax)
PR c++/65646
* decl.c (grokvardecl): Don't call check_explicit_specialization
for non-template members of a class template.
From-SVN: r221810
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/static36.C | 4 |
3 files changed, 13 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 946450b..904c920 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-04-01 Jason Merrill <jason@redhat.com> + + PR c++/65646 + * decl.c (grokvardecl): Don't call check_explicit_specialization + for non-template members of a class template. + 2015-04-01 Marek Polacek <polacek@redhat.com> PR c++/65554 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index f05aefa..31b8e0c 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8210,7 +8210,9 @@ grokvardecl (tree type, DECL_INTERFACE_KNOWN (decl) = 1; // Handle explicit specializations and instantiations of variable templates. - if (orig_declarator) + if (orig_declarator + /* For GCC 5 fix 65646 this way. */ + && current_tmpl_spec_kind (template_count) != tsk_none) decl = check_explicit_specialization (orig_declarator, decl, template_count, 0); diff --git a/gcc/testsuite/g++.dg/template/static36.C b/gcc/testsuite/g++.dg/template/static36.C new file mode 100644 index 0000000..36c48b0 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/static36.C @@ -0,0 +1,4 @@ +// PR c++/65646 + +template <typename = int> class A {}; +template <> A<> &A<>::a; // { dg-error "" } |