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
This commit is contained in:
Jason Merrill 2011-03-31 16:29:49 -04:00 committed by Jason Merrill
parent 4e36c2131f
commit c454d74afc
4 changed files with 19 additions and 0 deletions

View File

@ -1,5 +1,8 @@
2011-03-31 Jason Merrill <jason@redhat.com>
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.

View File

@ -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)

View File

@ -1,3 +1,7 @@
2011-03-31 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/defaulted24.C: New.
2011-03-31 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR target/16292

View File

@ -0,0 +1,6 @@
// PR c++/48280
// { dg-options -std=c++0x }
struct S {
template < typename > S (const S &) = default; // { dg-error "" }
};