diff options
author | Jason Merrill <jason@redhat.com> | 2011-02-25 01:22:51 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-02-25 01:22:51 -0500 |
commit | 4be5e5b12d501cb3aae673e673c30363b32480df (patch) | |
tree | 49b81324ade09d98696d503e866b68909cbe56f6 /gcc/cp/semantics.c | |
parent | 8da6ac3b5b71b1bb2d7c1883e7ab3ac05e6e8366 (diff) | |
download | gcc-4be5e5b12d501cb3aae673e673c30363b32480df.zip gcc-4be5e5b12d501cb3aae673e673c30363b32480df.tar.gz gcc-4be5e5b12d501cb3aae673e673c30363b32480df.tar.bz2 |
parser.c (cp_parser_constant_expression): Set non_integral_constant_expression correctly for C++0x too.
* parser.c (cp_parser_constant_expression): Set
non_integral_constant_expression correctly for C++0x too.
(cp_parser_static_assert): Allow non-constant expression.
(cp_parser_direct_declarator): Expect non_constant_p to be set
properly for C++0x.
* pt.c (value_dependent_expression_p): Handle TYPEID_EXPR.
* semantics.c (maybe_constant_value): Check type_unknown_p too.
(potential_rvalue_constant_expression): New.
(require_potential_rvalue_constant_expression): New.
From-SVN: r170488
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 8a7dd7d..199084a 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -7138,6 +7138,7 @@ maybe_constant_value (tree t) tree r; if (type_dependent_expression_p (t) + || type_unknown_p (t) || !potential_constant_expression (t) || value_dependent_expression_p (t)) return t; @@ -7727,6 +7728,14 @@ potential_constant_expression (tree t) return potential_constant_expression_1 (t, false, tf_none); } +/* As above, but require a constant rvalue. */ + +bool +potential_rvalue_constant_expression (tree t) +{ + return potential_constant_expression_1 (t, true, tf_none); +} + /* Like above, but complain about non-constant expressions. */ bool @@ -7734,6 +7743,14 @@ require_potential_constant_expression (tree t) { return potential_constant_expression_1 (t, false, tf_warning_or_error); } + +/* Cross product of the above. */ + +bool +require_potential_rvalue_constant_expression (tree t) +{ + return potential_constant_expression_1 (t, true, tf_warning_or_error); +} /* Constructor for a lambda expression. */ |