diff options
author | Jason Merrill <jason@redhat.com> | 2009-04-03 13:24:46 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2009-04-03 13:24:46 -0400 |
commit | b77ba909af773561e808c3d7cf64c46a8112dcab (patch) | |
tree | 33275fd3bd5b3964a1bbd9b544aa176572a87fce /gcc/cp | |
parent | 0c908ffc09740cce5c717fb2f8260866a425b04b (diff) | |
download | gcc-b77ba909af773561e808c3d7cf64c46a8112dcab.zip gcc-b77ba909af773561e808c3d7cf64c46a8112dcab.tar.gz gcc-b77ba909af773561e808c3d7cf64c46a8112dcab.tar.bz2 |
re PR c++/39608 ('expr' cannot appear in a constant-expression.)
PR c++/39608
* semantics.c (finish_id_expression): Don't assume a dependent
member of the current instantiation isn't a valid integral
constant expression. Check dependent_scope_p.
* pt.c (dependent_scope_p): Check TYPE_P.
From-SVN: r145508
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/pt.c | 5 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 7 |
3 files changed, 13 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5cba9d0..9bc48b6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2009-04-03 Jason Merrill <jason@redhat.com> + + PR c++/39608 + * semantics.c (finish_id_expression): Don't assume a dependent + member of the current instantiation isn't a valid integral + constant expression. Check dependent_scope_p. + * pt.c (dependent_scope_p): Check TYPE_P. + (tsubst_copy): If args is null, just return. + 2009-04-02 Jason Merrill <jason@redhat.com> PR c++/25185 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 8b2fa6e..90be6bc 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9999,7 +9999,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) enum tree_code code; tree r; - if (t == NULL_TREE || t == error_mark_node) + if (t == NULL_TREE || t == error_mark_node || args == NULL_TREE) return t; code = TREE_CODE (t); @@ -16168,7 +16168,8 @@ dependent_type_p (tree type) bool dependent_scope_p (tree scope) { - return dependent_type_p (scope) && !currently_open_class (scope); + return (scope && TYPE_P (scope) && dependent_type_p (scope) + && !currently_open_class (scope)); } /* Returns TRUE if EXPRESSION is dependent, according to CRITERION. */ diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index ee8c0cc..337b637 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2857,11 +2857,6 @@ finish_id_expression (tree id_expression, dependent. */ if (scope) { - /* Since this name was dependent, the expression isn't - constant -- yet. No error is issued because it might - be constant when things are instantiated. */ - if (integral_constant_expression_p) - *non_integral_constant_expression_p = true; if (TYPE_P (scope)) { if (address_p && done) @@ -2869,7 +2864,7 @@ finish_id_expression (tree id_expression, done, address_p, template_p, template_arg_p); - else if (dependent_type_p (scope)) + else if (dependent_scope_p (scope)) decl = build_qualified_name (/*type=*/NULL_TREE, scope, id_expression, |