From: Jason Merrill Date: Thu, 31 Mar 2011 20:29:49 +0000 (-0400) Subject: re PR c++/48280 ([C++0x] ICE: tree check: expected var_decl or function_decl, have... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c454d74afcf58585beddb8d300f77d615d65330c;p=gcc.git re PR c++/48280 ([C++0x] ICE: tree check: expected var_decl or function_decl, have template_decl in check_bases_and_members, at cp/class.c:4695) PR c++/48280 * method.c (defaultable_fn_check): Templates are not defaultable. From-SVN: r171797 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c2f98310397..dce49e948d4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-03-31 Jason Merrill + PR c++/48280 + * method.c (defaultable_fn_check): Templates are not defaultable. + * parser.c (cp_parser_init_declarator): Avoid redundant cp_finish_decl for member declarations. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 386a818ed1b..b741516d195 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1588,6 +1588,12 @@ defaultable_fn_check (tree fn) { special_function_kind kind = sfk_none; + if (template_parm_scope_p ()) + { + error ("a template cannot be defaulted"); + return false; + } + if (DECL_CONSTRUCTOR_P (fn)) { if (FUNCTION_FIRST_USER_PARMTYPE (fn) == void_list_node) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b34ea854e0f..81f9bb2ed92 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-03-31 Jason Merrill + + * g++.dg/cpp0x/defaulted24.C: New. + 2011-03-31 Rainer Orth PR target/16292 diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted24.C b/gcc/testsuite/g++.dg/cpp0x/defaulted24.C new file mode 100644 index 00000000000..307bf94ab85 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted24.C @@ -0,0 +1,6 @@ +// PR c++/48280 +// { dg-options -std=c++0x } + +struct S { + template < typename > S (const S &) = default; // { dg-error "" } +};