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
{
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.
--- /dev/null
+// 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;
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:;
}