Commit 11cc5f49 by Paolo Carlini Committed by Paolo Carlini

re PR c++/16603 (Incorrect enumerator type before enumeration's closing brace)

/cp
2012-01-01  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/16603
	* decl.c (build_enumerator): Don't call perform_integral_promotions
	on the value.

/testsuite
2012-01-01  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/16603
	* g++.dg/parse/enum8.C: New.

From-SVN: r182776
parent 9f88ff5a
2012-01-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/16603
* decl.c (build_enumerator): Don't call perform_integral_promotions
on the value.
2012-01-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51379
* typeck.c (build_reinterpret_cast_1): Implement resolution of
DR 799.
......
......@@ -12369,14 +12369,11 @@ build_enumerator (tree name, tree value, tree enumtype, location_t loc)
{
value = cxx_constant_value (value);
if (TREE_CODE (value) == INTEGER_CST
&& INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (value)))
if (TREE_CODE (value) != INTEGER_CST
|| ! INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (value)))
{
value = perform_integral_promotions (value);
}
else
{
error ("enumerator value for %qD is not an integer constant", name);
error ("enumerator value for %qD is not an integer constant",
name);
value = NULL_TREE;
}
}
......
2012-01-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/16603
* g++.dg/parse/enum8.C: New.
2012-01-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51379
* g++.dg/conversion/reinterpret4.C: New.
* g++.dg/conversion/reinterpret1.C: Adjust.
......
// PR c++/16603
char const c = 'q';
enum
{
x = c,
y = sizeof(x)
};
int test[y == sizeof(char) ? 1 : -1];
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