Commit 6f2d72e0 by Nathan Sidwell

re PR c++/66243 (enum class value is allowed to be initialized by value from other enum class)

	cp/
	PR c++/66243
	* decl.c (build_enumerator): Don't silently convert scoped enums.

	testsuite/
	PR c++/66243
	* g++.dg/cpp0x/pr66243.C: New.

From-SVN: r223636
parent bce0e38d
2015-05-22 Jan Hubicka <hubicka@ucw.cz>
2015-05-24 Nathan Sidwell <nathan@acm.org>
PR c++/66243
* decl.c (build_enumerator): Don't silently convert scoped enums.
2015-05-24 Jan Hubicka <hubicka@ucw.cz>
PR lto/66180
* mangle.c (mangle_decl): Mangle anonymous namespace types as
......
......@@ -13097,7 +13097,8 @@ build_enumerator (tree name, tree value, tree enumtype, tree attributes,
if (tmp_value)
value = tmp_value;
}
else if (! INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (value)))
else if (! INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P
(TREE_TYPE (value)))
value = perform_implicit_conversion_flags
(ENUM_UNDERLYING_TYPE (enumtype), value, tf_warning_or_error,
LOOKUP_IMPLICIT | LOOKUP_NO_NARROWING);
......
2015-05-22 Jan Hubicka <hubicka@ucw.cz>
2015-05-23 Nathan Sidwell <nathan@acm.org>
PR c++/66243
* g++.dg/cpp0x/pr66243.C: New.
2015-05-24 Jan Hubicka <hubicka@ucw.cz>
PR lto/66180
* g++.dg/lto/pr66180_0.C: New testcase.
......
// { dg-do compile { target c++11 } }
enum class A
{
X
};
enum class B
{
X = A::X // { dg-error "could not convert" }
};
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