Commit 7c55f410 by Paolo Carlini Committed by Paolo Carlini

re PR c++/56913 ([C++11] SFINAE for ill-formed pointer-to-member operators with…

re PR c++/56913 ([C++11] SFINAE for ill-formed pointer-to-member operators with incompatible ref-qualifiers)

/cp
2013-04-11  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/56913
	* typeck2.c (build_m_component_ref): Protect error calls with
	(complain & tf_error).

/testsuite
2013-04-11  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/56913
	* g++.dg/cpp0x/sfinae44.C: New.

From-SVN: r197780
parent 4d8f3296
2013-04-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/56913
* typeck2.c (build_m_component_ref): Protect error calls with
(complain & tf_error).
2013-04-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/54216
* parser.c (cp_parser_enum_specifier): Check for empty
anonymous enums and anonymous scoped enums.
......
......@@ -1722,11 +1722,19 @@ build_m_component_ref (tree datum, tree component, tsubst_flags_t complain)
{
bool lval = real_lvalue_p (datum);
if (lval && FUNCTION_RVALUE_QUALIFIED (type))
error ("pointer-to-member-function type %qT requires an rvalue",
ptrmem_type);
{
if (complain & tf_error)
error ("pointer-to-member-function type %qT requires an rvalue",
ptrmem_type);
return error_mark_node;
}
else if (!lval && !FUNCTION_RVALUE_QUALIFIED (type))
error ("pointer-to-member-function type %qT requires an lvalue",
ptrmem_type);
{
if (complain & tf_error)
error ("pointer-to-member-function type %qT requires an lvalue",
ptrmem_type);
return error_mark_node;
}
}
return build2 (OFFSET_REF, type, datum, component);
}
......
2013-04-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/56913
* g++.dg/cpp0x/sfinae44.C: New.
2013-04-11 Arnaud Charlet <charlet@adacore.com>
* ada/acats/run_all.sh: Remove special handling of -gnat95 switch.
......
// PR c++/56913
// { dg-do compile { target c++11 } }
template<typename T>
T &&declval();
template<typename T, typename U,
typename = decltype((declval<T>().*declval<U>())())>
constexpr bool test(int)
{
return true;
}
template<typename T, typename U>
constexpr bool test(...)
{
return false;
}
struct S
{};
static_assert(!test<S, void (S::*)() &>(0), "");
static_assert(test<S, void (S::*)() &&>(0), "");
static_assert(test<S &, void (S::*)() &>(0), "");
static_assert(!test<S &, void (S::*)() &&>(0), "");
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