Commit 15031017 authored by jason's avatar jason
Browse files

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/trunk@174031 138bc75d-0d04-0410-961f-82ee72b054a4
parent 687d0767
2011-05-22 Jason Merrill <jason@redhat.com>
PR c++/48647
* typeck.c (composite_pointer_type_r): Return error_mark_node
on error in SFINAE context.
2011-05-20 Jason Merrill <jason@redhat.com> 2011-05-20 Jason Merrill <jason@redhat.com>
PR c++/48945 PR c++/48945
......
...@@ -516,7 +516,8 @@ composite_pointer_type_r (tree t1, tree t2, ...@@ -516,7 +516,8 @@ composite_pointer_type_r (tree t1, tree t2,
{ {
if (complain & tf_error) if (complain & tf_error)
composite_pointer_error (DK_PERMERROR, t1, t2, operation); composite_pointer_error (DK_PERMERROR, t1, t2, operation);
else
return error_mark_node;
result_type = void_type_node; result_type = void_type_node;
} }
result_type = cp_build_qualified_type (result_type, result_type = cp_build_qualified_type (result_type,
...@@ -527,9 +528,13 @@ composite_pointer_type_r (tree t1, tree t2, ...@@ -527,9 +528,13 @@ composite_pointer_type_r (tree t1, tree t2,
if (TYPE_PTR_TO_MEMBER_P (t1)) if (TYPE_PTR_TO_MEMBER_P (t1))
{ {
if (!same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1), if (!same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1),
TYPE_PTRMEM_CLASS_TYPE (t2)) TYPE_PTRMEM_CLASS_TYPE (t2)))
&& (complain & tf_error)) {
composite_pointer_error (DK_PERMERROR, t1, t2, operation); 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 = build_ptrmem_type (TYPE_PTRMEM_CLASS_TYPE (t1),
result_type); result_type);
} }
......
2011-05-22 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/sfinae23.C: New.
* g++.dg/cpp0x/sfinae8.C: Correct.
2011-05-22 Thomas Koenig <tkoenig@gcc.gnu.org> 2011-05-22 Thomas Koenig <tkoenig@gcc.gnu.org>
* gfortran.dg/function_optimize_8.f90: New test case. * gfortran.dg/function_optimize_8.f90: New test case.
......
// 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));
...@@ -120,7 +120,7 @@ STATIC_ASSERT((!is_equality_comparable<Y, X>::value)); ...@@ -120,7 +120,7 @@ STATIC_ASSERT((!is_equality_comparable<Y, X>::value));
STATIC_ASSERT((!is_equality_comparable<Y>::value)); STATIC_ASSERT((!is_equality_comparable<Y>::value));
STATIC_ASSERT((is_equality_comparable<int X::*>::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 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*, Z*>::value));
STATIC_ASSERT((!is_equality_comparable<X*, Y*>::value)); STATIC_ASSERT((!is_equality_comparable<X*, Y*>::value));
...@@ -139,7 +139,7 @@ STATIC_ASSERT((!is_not_equal_comparable<Y, X>::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<Y>::value));
STATIC_ASSERT((is_not_equal_comparable<int X::*>::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 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*, Z*>::value));
STATIC_ASSERT((!is_not_equal_comparable<X*, Y*>::value)); STATIC_ASSERT((!is_not_equal_comparable<X*, Y*>::value));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment