aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/method.c6
2 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c2f9831..dce49e9 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 386a818..b741516 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)