aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-04-25 12:24:42 -0400
committerJason Merrill <jason@gcc.gnu.org>2013-04-25 12:24:42 -0400
commit17365662e484b762af97f4b25f483411ebec3fb0 (patch)
tree1eabc21918d0b63cac9450ae396c4bdf69c80c37 /gcc/cp
parent4794d4b5fe27bd40d4fa11ce8319143cf4d259c2 (diff)
downloadgcc-17365662e484b762af97f4b25f483411ebec3fb0.zip
gcc-17365662e484b762af97f4b25f483411ebec3fb0.tar.gz
gcc-17365662e484b762af97f4b25f483411ebec3fb0.tar.bz2
re PR c++/56859 (alignas() fails in template)
PR c++/56859 * typeck.c (cxx_alignas_expr): Handle value-dependence properly. From-SVN: r198310
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/typeck.c21
2 files changed, 10 insertions, 14 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a1471dd..33fc34a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2013-04-25 Jason Merrill <jason@redhat.com>
+ PR c++/56859
+ * typeck.c (cxx_alignas_expr): Handle value-dependence properly.
+
PR c++/50261
* init.c (perform_member_init): Call reshape_init.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 84da5de..b761dd5 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1725,15 +1725,19 @@ cxx_alignas_expr (tree e)
When the alignment-specifier is of the form
alignas(type-id ), it shall have the same effect as
- alignas( alignof(type-id )). */
+ alignas(alignof(type-id )). */
return cxx_sizeof_or_alignof_type (e, ALIGNOF_EXPR, false);
-
/* If we reach this point, it means the alignas expression if of
the form "alignas(assignment-expression)", so we should follow
what is stated by [dcl.align]/2. */
+ if (value_dependent_expression_p (e))
+ /* Leave value-dependent expression alone for now. */
+ return e;
+
+ e = fold_non_dependent_expr (e);
e = mark_rvalue_use (e);
/* [dcl.align]/2 says:
@@ -1741,18 +1745,7 @@ cxx_alignas_expr (tree e)
the assignment-expression shall be an integral constant
expression. */
- e = fold_non_dependent_expr (e);
- if (value_dependent_expression_p (e))
- /* Leave value-dependent expression alone for now. */;
- else
- e = cxx_constant_value (e);
-
- if (e == NULL_TREE
- || e == error_mark_node
- || TREE_CODE (e) != INTEGER_CST)
- return error_mark_node;
-
- return e;
+ return cxx_constant_value (e);
}