summaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-06 01:23:54 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-06 01:23:54 +0000
commit62116ec373e786a0b9dcb16c8afbd62fa2f45006 (patch)
tree17dc867104325855fe255d6858ff0978e0b8936c /gcc/cp/parser.c
parentc07054e9cb2002971dbefcf713d5dd3ee131bfc4 (diff)
downloadgcc-62116ec373e786a0b9dcb16c8afbd62fa2f45006.tar.gz
PR c++/32245
* init.c (build_zero_init): Always build an initializer for non-static storage. * typeck2.c (build_functional_cast): Use build_zero_init. PR c++/32251 * init.c (build_new_1): Always pass the allocation function to build_op_delete_call. * call.c (build_op_delete_call): Handle operator delete with a variable-argument list. Do not issue an error when no matching deallocation function is available for a new operator. PR c++/31992 * cp-tree.h (any_value_dependent_elements_p): Declare it. * decl.c (value_dependent_init_p): New function. (cp_finish_decl): Use it. * pt.c (value_dependent_expression_p): Use any_value_dependent_elements_p. * parser.c (cp_parser_primary_expression): Add comment about treating dependent qualified names as integral constant-expressions. PR c++/32245 * g++.dg/init/ptrmem4.C: New test. PR c++/32251 * g++.dg/init/new21.C: Likewise. PR c++/31992 * g++.dg/template/static30.C: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126399 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index ae970d68da8..0bd33d692a1 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -3368,7 +3368,19 @@ cp_parser_primary_expression (cp_parser *parser,
/* If name lookup gives us a SCOPE_REF, then the
qualifying scope was dependent. */
if (TREE_CODE (decl) == SCOPE_REF)
- return decl;
+ {
+ /* At this point, we do not know if DECL is a valid
+ integral constant expression. We assume that it is
+ in fact such an expression, so that code like:
+
+ template <int N> struct A {
+ int a[B<N>::i];
+ };
+
+ is accepted. At template-instantiation time, we
+ will check that B<N>::i is actually a constant. */
+ return decl;
+ }
/* Check to see if DECL is a local variable in a context
where that is forbidden. */
if (parser->local_variables_forbidden_p