Commit c51dc544 by Jason Merrill Committed by Jason Merrill

decl.c (build_enumerator): Don't perform integral promotions on non-integral constants.

	* decl.c (build_enumerator): Don't perform integral promotions on
	non-integral constants.

From-SVN: r170008
parent cb8384a3
2011-02-09 Jason Merrill <jason@redhat.com>
* decl.c (build_enumerator): Don't perform integral promotions on
non-integral constants.
* cvt.c (convert_to_void): Handle null op1.
* class.c (type_has_constexpr_default_constructor): Make sure the
......
......@@ -11869,7 +11869,8 @@ build_enumerator (tree name, tree value, tree enumtype, location_t loc)
{
value = cxx_constant_value (value);
if (TREE_CODE (value) == INTEGER_CST)
if (TREE_CODE (value) == INTEGER_CST
&& INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (value)))
{
value = perform_integral_promotions (value);
}
......
2011-02-09 Jason Merrill <jason@redhat.com>
* g++.dg/ext/label10.C: Adjust for C++0x mode.
* g++.dg/cpp0x/regress/ext-label10.C: Copy it.
* g++.dg/cpp0x/regress/ext-cond1.C: Copy from ext/cond1.C.
* g++.dg/cpp0x/regress/abi-empty7.C: New.
......
// PR c++/33836
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
template<int N> struct A
{
enum { M = && N }; // { dg-error "referenced outside|cannot appear in|not an integer constant" }
};
A<0> a;
void foo ()
{
__label__ P;
enum { O = && P }; // { dg-error "cannot appear in|not an integer constant" }
P:;
}
// PR c++/33836
// { dg-do compile }
// { dg-options "-std=gnu++98" }
// { dg-options "" }
template<int N> struct A
{
enum { M = && N }; // { dg-error "referenced outside|cannot appear in" }
enum { M = && N }; // { dg-error "referenced outside|cannot appear in|not an integer constant" }
};
A<0> a;
......@@ -12,6 +12,6 @@ A<0> a;
void foo ()
{
__label__ P;
enum { O = && P }; // { dg-error "cannot appear in" }
enum { O = && P }; // { dg-error "cannot appear in|not an integer constant" }
P:;
}
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