aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0051-PR-c-48280.patch
blob: a7d37a8713b942ec1d39606d9986d192b733f93f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From c965b9c986732377eb96e00f7266e281f345a00b Mon Sep 17 00:00:00 2001
From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu, 31 Mar 2011 20:33:07 +0000
Subject: [PATCH 051/200] 	PR c++/48280
 	* method.c (defaultable_fn_check): Templates are not defaultable.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@171798 138bc75d-0d04-0410-961f-82ee72b054a4

index d70da95..e6f3c25 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1594,6 +1594,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)
new file mode 100644
index 0000000..307bf94
--- /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 "" }
+};
-- 
1.7.0.4