Commit 5d5006cc by Paolo Carlini Committed by Paolo Carlini

re PR c++/53745 ([C++11] Poor diagnostic for ill-formed narrowing conversion in…

re PR c++/53745 ([C++11] Poor diagnostic for ill-formed narrowing conversion in enumerator initializer)

/cp
2013-05-04  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/53745
	* decl.c (build_enumerator): Improve error message.

/testsuite
2013-05-04  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/53745
	* g++.dg/cpp0x/enum27.C: New.
	* g++.dg/cpp0x/enum_base.C: Adjust.

From-SVN: r198607
parent defa0f99
2013-05-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/53745
* decl.c (build_enumerator): Improve error message.
2013-05-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/14283
......
......@@ -12847,8 +12847,8 @@ incremented enumerator value is too large for %<long%>");
&& TREE_CODE (value) == INTEGER_CST)
{
if (!int_fits_type_p (value, ENUM_UNDERLYING_TYPE (enumtype)))
error ("enumerator value %E is too large for underlying type %<%T%>",
value, ENUM_UNDERLYING_TYPE (enumtype));
error ("enumerator value %E is outside the range of underlying "
"type %<%T%>", value, ENUM_UNDERLYING_TYPE (enumtype));
/* Convert the value to the appropriate type. */
value = convert (ENUM_UNDERLYING_TYPE (enumtype), value);
......
2013-05-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/53745
* g++.dg/cpp0x/enum27.C: New.
* g++.dg/cpp0x/enum_base.C: Adjust.
2013-05-04 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/56205
......
// PR c++/53745
// { dg-do compile { target c++11 } }
enum E : unsigned { e = -1 }; // { dg-error "outside the range" }
......@@ -6,11 +6,11 @@ enum E1 : char { };
enum E2 : signed const short { };
enum E3 : uvlonglong { };
enum E4 : char {
val = 500 // { dg-error "too large" }
val = 500 // { dg-error "outside the range" }
};
enum class E5 {
val = (unsigned long long)-1 // { dg-error "too large" }
val = (unsigned long long)-1 // { dg-error "outside the range" }
};
typedef float Float;
......
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