diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2012-01-01 22:33:31 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2012-01-01 22:33:31 +0000 |
commit | 11cc5f49ddde6807b157dfaeffc26d286eaf2549 (patch) | |
tree | 808f9cfab7d955a51cefa33b0c0ac2bd73f801d4 /gcc | |
parent | 9f88ff5a1fedb4ac29628ec421ff0cc613ba6f38 (diff) | |
download | gcc-11cc5f49ddde6807b157dfaeffc26d286eaf2549.zip gcc-11cc5f49ddde6807b157dfaeffc26d286eaf2549.tar.gz gcc-11cc5f49ddde6807b157dfaeffc26d286eaf2549.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/enum8.C | 11 |
4 files changed, 26 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b4a3df4..c602721 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 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. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2fc794b..48f3085 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cfbef8d..3e35722 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 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. diff --git a/gcc/testsuite/g++.dg/parse/enum8.C b/gcc/testsuite/g++.dg/parse/enum8.C new file mode 100644 index 0000000..83dd6e0 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/enum8.C @@ -0,0 +1,11 @@ +// PR c++/16603 + +char const c = 'q'; + +enum + { + x = c, + y = sizeof(x) + }; + +int test[y == sizeof(char) ? 1 : -1]; |