Commit 55b13820 by Jason Merrill Committed by Jason Merrill

re PR c++/48534 ([C++0x][SFINAE] Compiler break down on explicit scoped enum => bool conversion)

	PR c++/48534
	* cvt.c (ocp_convert): Use build_nop to convert to underlying type
	of scoped enum.

From-SVN: r172284
parent ac4b1cc0
2011-04-11 Jason Merrill <jason@redhat.com>
PR c++/48534
* cvt.c (ocp_convert): Use build_nop to convert to underlying type
of scoped enum.
PR c++/48523
* tree.c (maybe_dummy_object): Use build_x_indirect_ref rather
than cp_build_indirect_ref.
......
......@@ -731,7 +731,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
/* We can't implicitly convert a scoped enum to bool, so convert
to the underlying type first. */
if (SCOPED_ENUM_P (intype) && (convtype & CONV_STATIC))
e = convert (ENUM_UNDERLYING_TYPE (intype), e);
e = build_nop (ENUM_UNDERLYING_TYPE (intype), e);
return cp_truthvalue_conversion (e);
}
......
2011-04-11 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/enum10.C: New.
* g++.dg/cpp0x/lambda/lambda-this4.C: New.
* g++.dg/cpp0x/rv-func.C: New.
......
// PR c++/48534
// { dg-options -std=c++0x }
enum class OpSE : bool;
int main()
{
return static_cast<bool>(OpSE());
}
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