summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0308-PR-c-48647.patch
blob: fc369858aa662f2f1511f33dcefcc26b28fa9cda (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
From 0bde772c9cd71ef31d4d1e99fb3687eb7086c330 Mon Sep 17 00:00:00 2001
From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Sun, 22 May 2011 20:31:59 +0000
Subject: [PATCH] 	PR c++/48647
 	* typeck.c (composite_pointer_type_r): Return error_mark_node
 	on error in SFINAE context.

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

index 59bf3ab..9a81ea5 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -516,7 +516,8 @@ composite_pointer_type_r (tree t1, tree t2,
     {
       if (complain & tf_error)
 	composite_pointer_error (DK_PERMERROR, t1, t2, operation);
-
+      else
+	return error_mark_node;
       result_type = void_type_node;
     }
   result_type = cp_build_qualified_type (result_type,
@@ -527,9 +528,13 @@ composite_pointer_type_r (tree t1, tree t2,
   if (TYPE_PTR_TO_MEMBER_P (t1))
     {
       if (!same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1),
-			TYPE_PTRMEM_CLASS_TYPE (t2))
-	  && (complain & tf_error))
-	composite_pointer_error (DK_PERMERROR, t1, t2, operation);
+			TYPE_PTRMEM_CLASS_TYPE (t2)))
+	{
+	  if (complain & tf_error)
+	    composite_pointer_error (DK_PERMERROR, t1, t2, operation);
+	  else
+	    return error_mark_node;
+	}
       result_type = build_ptrmem_type (TYPE_PTRMEM_CLASS_TYPE (t1),
 				       result_type);
     }
new file mode 100644
index 0000000..4e2ea88
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/sfinae23.C
@@ -0,0 +1,28 @@
+// PR c++/48647
+// { dg-options -std=c++0x }
+
+template< class T >
+T&& declval();
+
+template< class T, class U >
+decltype( true ? declval<T>() : declval<U>() ) test( int );
+
+template< class T, class U >
+void test( ... );
+
+
+template< class T, class U >
+struct is_same {
+  static const bool value = false;
+};
+
+template< class T >
+struct is_same<T, T> {
+  static const bool value = true;
+};
+
+#define SA(X) static_assert ((X),#X)
+
+typedef decltype( test<int*, double*>(0) ) void_expected;
+SA ((is_same<void_expected, void>::value));
+SA ((!is_same<void_expected, void*>::value));
diff --git a/gcc/testsuite/g++.dg/template/sfinae8.C b/gcc/testsuite/g++.dg/template/sfinae8.C
index 2ad68dc..5ac09c6 100644
--- a/gcc/testsuite/g++.dg/template/sfinae8.C
+++ b/gcc/testsuite/g++.dg/template/sfinae8.C
@@ -120,7 +120,7 @@ STATIC_ASSERT((!is_equality_comparable<Y, X>::value));
 STATIC_ASSERT((!is_equality_comparable<Y>::value));
 STATIC_ASSERT((is_equality_comparable<int X::*>::value));
 STATIC_ASSERT((!is_equality_comparable<int X::*, int Y::*>::value));
-STATIC_ASSERT((is_equality_comparable<int*, float*>::value));
+STATIC_ASSERT((!is_equality_comparable<int*, float*>::value));
 STATIC_ASSERT((is_equality_comparable<X*, Z*>::value));
 STATIC_ASSERT((!is_equality_comparable<X*, Y*>::value));
 
@@ -139,7 +139,7 @@ STATIC_ASSERT((!is_not_equal_comparable<Y, X>::value));
 STATIC_ASSERT((!is_not_equal_comparable<Y>::value));
 STATIC_ASSERT((is_not_equal_comparable<int X::*>::value));
 STATIC_ASSERT((!is_not_equal_comparable<int X::*, int Y::*>::value));
-STATIC_ASSERT((is_not_equal_comparable<int*, float*>::value));
+STATIC_ASSERT((!is_not_equal_comparable<int*, float*>::value));
 STATIC_ASSERT((is_not_equal_comparable<X*, Z*>::value));
 STATIC_ASSERT((!is_not_equal_comparable<X*, Y*>::value));
 
-- 
1.7.0.4