diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0308-PR-c-48647.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0308-PR-c-48647.patch | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0308-PR-c-48647.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0308-PR-c-48647.patch new file mode 100644 index 0000000000..fc369858aa --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0308-PR-c-48647.patch | |||
@@ -0,0 +1,97 @@ | |||
1 | From 0bde772c9cd71ef31d4d1e99fb3687eb7086c330 Mon Sep 17 00:00:00 2001 | ||
2 | From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | ||
3 | Date: Sun, 22 May 2011 20:31:59 +0000 | ||
4 | Subject: [PATCH] PR c++/48647 | ||
5 | * typeck.c (composite_pointer_type_r): Return error_mark_node | ||
6 | on error in SFINAE context. | ||
7 | |||
8 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174044 138bc75d-0d04-0410-961f-82ee72b054a4 | ||
9 | |||
10 | index 59bf3ab..9a81ea5 100644 | ||
11 | --- a/gcc/cp/typeck.c | ||
12 | +++ b/gcc/cp/typeck.c | ||
13 | @@ -516,7 +516,8 @@ composite_pointer_type_r (tree t1, tree t2, | ||
14 | { | ||
15 | if (complain & tf_error) | ||
16 | composite_pointer_error (DK_PERMERROR, t1, t2, operation); | ||
17 | - | ||
18 | + else | ||
19 | + return error_mark_node; | ||
20 | result_type = void_type_node; | ||
21 | } | ||
22 | result_type = cp_build_qualified_type (result_type, | ||
23 | @@ -527,9 +528,13 @@ composite_pointer_type_r (tree t1, tree t2, | ||
24 | if (TYPE_PTR_TO_MEMBER_P (t1)) | ||
25 | { | ||
26 | if (!same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1), | ||
27 | - TYPE_PTRMEM_CLASS_TYPE (t2)) | ||
28 | - && (complain & tf_error)) | ||
29 | - composite_pointer_error (DK_PERMERROR, t1, t2, operation); | ||
30 | + TYPE_PTRMEM_CLASS_TYPE (t2))) | ||
31 | + { | ||
32 | + if (complain & tf_error) | ||
33 | + composite_pointer_error (DK_PERMERROR, t1, t2, operation); | ||
34 | + else | ||
35 | + return error_mark_node; | ||
36 | + } | ||
37 | result_type = build_ptrmem_type (TYPE_PTRMEM_CLASS_TYPE (t1), | ||
38 | result_type); | ||
39 | } | ||
40 | new file mode 100644 | ||
41 | index 0000000..4e2ea88 | ||
42 | --- /dev/null | ||
43 | +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae23.C | ||
44 | @@ -0,0 +1,28 @@ | ||
45 | +// PR c++/48647 | ||
46 | +// { dg-options -std=c++0x } | ||
47 | + | ||
48 | +template< class T > | ||
49 | +T&& declval(); | ||
50 | + | ||
51 | +template< class T, class U > | ||
52 | +decltype( true ? declval<T>() : declval<U>() ) test( int ); | ||
53 | + | ||
54 | +template< class T, class U > | ||
55 | +void test( ... ); | ||
56 | + | ||
57 | + | ||
58 | +template< class T, class U > | ||
59 | +struct is_same { | ||
60 | + static const bool value = false; | ||
61 | +}; | ||
62 | + | ||
63 | +template< class T > | ||
64 | +struct is_same<T, T> { | ||
65 | + static const bool value = true; | ||
66 | +}; | ||
67 | + | ||
68 | +#define SA(X) static_assert ((X),#X) | ||
69 | + | ||
70 | +typedef decltype( test<int*, double*>(0) ) void_expected; | ||
71 | +SA ((is_same<void_expected, void>::value)); | ||
72 | +SA ((!is_same<void_expected, void*>::value)); | ||
73 | diff --git a/gcc/testsuite/g++.dg/template/sfinae8.C b/gcc/testsuite/g++.dg/template/sfinae8.C | ||
74 | index 2ad68dc..5ac09c6 100644 | ||
75 | --- a/gcc/testsuite/g++.dg/template/sfinae8.C | ||
76 | +++ b/gcc/testsuite/g++.dg/template/sfinae8.C | ||
77 | @@ -120,7 +120,7 @@ STATIC_ASSERT((!is_equality_comparable<Y, X>::value)); | ||
78 | STATIC_ASSERT((!is_equality_comparable<Y>::value)); | ||
79 | STATIC_ASSERT((is_equality_comparable<int X::*>::value)); | ||
80 | STATIC_ASSERT((!is_equality_comparable<int X::*, int Y::*>::value)); | ||
81 | -STATIC_ASSERT((is_equality_comparable<int*, float*>::value)); | ||
82 | +STATIC_ASSERT((!is_equality_comparable<int*, float*>::value)); | ||
83 | STATIC_ASSERT((is_equality_comparable<X*, Z*>::value)); | ||
84 | STATIC_ASSERT((!is_equality_comparable<X*, Y*>::value)); | ||
85 | |||
86 | @@ -139,7 +139,7 @@ STATIC_ASSERT((!is_not_equal_comparable<Y, X>::value)); | ||
87 | STATIC_ASSERT((!is_not_equal_comparable<Y>::value)); | ||
88 | STATIC_ASSERT((is_not_equal_comparable<int X::*>::value)); | ||
89 | STATIC_ASSERT((!is_not_equal_comparable<int X::*, int Y::*>::value)); | ||
90 | -STATIC_ASSERT((is_not_equal_comparable<int*, float*>::value)); | ||
91 | +STATIC_ASSERT((!is_not_equal_comparable<int*, float*>::value)); | ||
92 | STATIC_ASSERT((is_not_equal_comparable<X*, Z*>::value)); | ||
93 | STATIC_ASSERT((!is_not_equal_comparable<X*, Y*>::value)); | ||
94 | |||
95 | -- | ||
96 | 1.7.0.4 | ||
97 | |||