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
This commit is contained in:
Mark Mitchell 2007-03-12 00:26:39 +00:00 committed by Mark Mitchell
parent efb84847df
commit 3c38f0ff2e
6 changed files with 72 additions and 1 deletions

View File

@ -1,3 +1,12 @@
2007-03-11 Mark Mitchell <mark@codesourcery.com>
PR c++/31038
* parser.c (cp_parser_postfix_expression): Disallow compound
literals in constant expressions.
PR c++/30328
* semantics.c (finish_typeof): Use unlowered_expr_type.
2007-03-10 Mark Mitchell <mark@codesourcery.com>
PR c++/30274

View File

@ -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);

View File

@ -2927,7 +2927,7 @@ finish_typeof (tree expr)
return type;
}
type = TREE_TYPE (expr);
type = unlowered_expr_type (expr);
if (!type || type == unknown_type_node)
{

View File

@ -1,3 +1,11 @@
2007-03-11 Mark Mitchell <mark@codesourcery.com>
PR c++/31038
* g++.dg/template/complit2.C: New test.
PR c++/30328
* g++.dg/ext/bitfield1.C: New test.
2007-03-11 Paul Thomas <pault@gcc.gnu.org>
PR fortran/30883

View File

@ -0,0 +1,22 @@
// PR c++/30328
// { dg-do link }
// { dg-options "" }
struct S
{
signed int a:17;
} x;
typedef typeof (x.a) foo;
template <class T>
T* inc(T* p) { return p+1; }
int main ()
{
foo x[2] = { 1,2 };
int y[2] = { 1,2 };
*inc(x);
*inc(y);
return 0;
}

View File

@ -0,0 +1,17 @@
// PR c++/31038
// { dg-options "" }
template<int> void foo()
{
int i = (int) { 0 };
}
template void foo<0>();
int f();
template<int> void bar()
{
int i = (int) { f() };
}
template void bar<0>();