diff options
author | Jason Merrill <jason@redhat.com> | 2013-02-22 17:24:40 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2013-02-22 17:24:40 -0500 |
commit | 5c505cbacf8a90db83e3727ad6a1cb7f52b82dae (patch) | |
tree | d359cdf5c03ea0e537a1eadf6aa31f904bf5e276 /gcc | |
parent | 82a1326b09d144a886124770e405a807f27ad4e8 (diff) | |
download | gcc-5c505cbacf8a90db83e3727ad6a1cb7f52b82dae.zip gcc-5c505cbacf8a90db83e3727ad6a1cb7f52b82dae.tar.gz gcc-5c505cbacf8a90db83e3727ad6a1cb7f52b82dae.tar.bz2 |
re PR c++/40405 (ICE with invalid initialization of template member)
PR c++/40405
* pt.c (push_template_decl_real): Set DECL_INTERFACE_KNOWN
if we got the wrong number of template parms.
From-SVN: r196231
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/error49.C | 10 |
3 files changed, 16 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ed5d399..4a2baa0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2013-02-22 Jason Merrill <jason@redhat.com> + PR c++/40405 + * pt.c (push_template_decl_real): Set DECL_INTERFACE_KNOWN + if we got the wrong number of template parms. + PR c++/56377 * pt.c (fn_type_unification): Use explicit args in template instantiation context. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a39d114..5ff0821 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4782,6 +4782,8 @@ push_template_decl_real (tree decl, bool is_friend) error ("got %d template parameters for %q#T", TREE_VEC_LENGTH (a), current); error (" but %d required", TREE_VEC_LENGTH (t)); + /* Avoid crash in import_export_decl. */ + DECL_INTERFACE_KNOWN (decl) = 1; return error_mark_node; } diff --git a/gcc/testsuite/g++.dg/template/error49.C b/gcc/testsuite/g++.dg/template/error49.C new file mode 100644 index 0000000..57789a7 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/error49.C @@ -0,0 +1,10 @@ +// PR c++/40405 + +template<int, int> struct A +{ + static int i; +}; + +template<int> int A<0,0>::i = 0; // { dg-error "" } + +int j = A<0,0>::i; |