re PR c++/10479 (alignof and sizeof (and other expressions) in attributes does not compile inside template classes)

PR c++/10479
	* parser.c (cp_parser_parenthesized_expression_list): Fold
	non-dependent expressions in attribute lists.

	PR c++/10479
	* g++.dg/ext/attrib16.C: New test.

From-SVN: r89135
This commit is contained in:
Giovanni Bajo 2004-10-16 11:04:58 +00:00
parent 29c431a17d
commit 1ed3dfd55d
4 changed files with 23 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2004-10-16 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/10479
* parser.c (cp_parser_parenthesized_expression_list): Fold
non-dependent expressions in attribute lists.
2004-10-15 Mark Mitchell <mark@codesourcery.com>
PR c++/17042

View File

@ -4420,6 +4420,7 @@ cp_parser_parenthesized_expression_list (cp_parser* parser,
bool *non_constant_p)
{
tree expression_list = NULL_TREE;
bool fold_expr_p = is_attribute_list;
tree identifier = NULL_TREE;
/* Assume all the expressions will be constant. */
@ -4462,6 +4463,9 @@ cp_parser_parenthesized_expression_list (cp_parser* parser,
else
expr = cp_parser_assignment_expression (parser);
if (fold_expr_p)
expr = fold_non_dependent_expr (expr);
/* Add it to the list. We add error_mark_node
expressions to the list, so that we can still tell if
the correct form for a parenthesized expression-list

View File

@ -1,3 +1,8 @@
2004-10-16 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/10479
* g++.dg/ext/attrib16.C: New test.
2004-10-15 Mark Mitchell <mark@codesourcery.com>
PR c++/17042

View File

@ -0,0 +1,8 @@
// { dg-do compile }
// Origin: <rguenth at tat dot physik dot uni-tuebingen dot de>
// PR c++/10479: use of non dependent expressions in attributes in templates
template <int i>
struct foo2 {
float bar __attribute__((aligned(__alignof__(double))));
};