aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2007-03-12 00:26:39 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2007-03-12 00:26:39 +0000
commit3c38f0ff2e34900a89268b0880c9b8e33cdce715 (patch)
treee8f2a57a999cd544124fd9b8e1410f55c4e85e82 /gcc/cp/parser.c
parentefb84847dfc11e5fb694c984f5421562bcc200f8 (diff)
downloadgcc-3c38f0ff2e34900a89268b0880c9b8e33cdce715.zip
gcc-3c38f0ff2e34900a89268b0880c9b8e33cdce715.tar.gz
gcc-3c38f0ff2e34900a89268b0880c9b8e33cdce715.tar.bz2
re PR c++/30328 (bit-field: unassemblable assembly code)
PR c++/30328 * semantics.c (finish_typeof): Use unlowered_expr_type. PR c++/30328 * g++.dg/ext/bitfield1.C: New test. PR c++/31038 * parser.c (cp_parser_postfix_expression): Disallow compound literals in constant expressions. PR c++/31038 * g++.dg/template/complit2.C: New test. From-SVN: r122829
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index f81fbdf..54c7668 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -4343,6 +4343,21 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p)
allowed in standard C++. */
if (pedantic)
pedwarn ("ISO C++ forbids compound-literals");
+ /* For simplicitly, we disallow compound literals in
+ constant-expressions for simpliicitly. We could
+ allow compound literals of integer type, whose
+ initializer was a constant, in constant
+ expressions. Permitting that usage, as a further
+ extension, would not change the meaning of any
+ currently accepted programs. (Of course, as
+ compound literals are not part of ISO C++, the
+ standard has nothing to say.) */
+ if (cp_parser_non_integral_constant_expression
+ (parser, "non-constant compound literals"))
+ {
+ postfix_expression = error_mark_node;
+ break;
+ }
/* Form the representation of the compound-literal. */
postfix_expression
= finish_compound_literal (type, initializer_list);