From fe89d79748951c95a113e10b6184ca5284d3936d Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Thu, 15 Jun 2006 03:26:38 +0000 Subject: re PR c++/26559 (ICE with __builtin_constant_p in template argument) 2006-06-14 Mark Mitchell PR c++/26559 * c-common.h (c_finish_omp_atomic): Adjust declaration. * c-omp.c (c_finish_omp_atomic): Return the expression to perform, rather than calling add_stmt on it. * c-parser.c (c_parser_omp_atomic): Adjust accordingly. 2006-06-14 Mark Mitchell PR c++/26559 * pt.c (tsubst_expr): Use finish_omp_atomic. (value_dependent_expression_p): All CALL_EXPRs are dependent. * semantics.c (finish_omp_atomic): Rework to use standard paradigms for handling non-dependent expressions. 2006-06-14 Mark Mitchell PR c++/26559 * g++.dg/template/builtin1.C: New test. * g++.dg/gomp/tpl-atomic-2.C: Remove XFAIL. From-SVN: r114665 --- gcc/cp/ChangeLog | 13 +++++++++++++ gcc/cp/pt.c | 38 +++++++------------------------------- 2 files changed, 20 insertions(+), 31 deletions(-) (limited to 'gcc/cp') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f8721f7..abd63d9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -4,6 +4,19 @@ 2006-06-14 Mark Mitchell + * parser.c (cp_parser_unqualified_id): Use constructor_name_p to + check destructor names. + (cp_parser_nested_name_specifier_opt): Remove invalid + optimization. + + * parser.c (cp_parser_declarator): Robustify. + + PR c++/26559 + * pt.c (tsubst_expr): Use finish_omp_atomic. + (value_dependent_expression_p): All CALL_EXPRs are dependent. + * semantics.c (finish_omp_atomic): Rework to use standard + paradigms for handling non-dependent expressions. + PR c++/28018 * typeck.c (build_modify_expr): Disallow array assignment. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 07963d6..0cc93fd 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8546,10 +8546,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl) tree op0, op1; op0 = tsubst_expr (TREE_OPERAND (t, 0), args, complain, in_decl); op1 = tsubst_expr (TREE_OPERAND (t, 1), args, complain, in_decl); - if (OMP_ATOMIC_DEPENDENT_P (t)) - c_finish_omp_atomic (OMP_ATOMIC_CODE (t), op0, op1); - else - add_stmt (build2 (OMP_ATOMIC, void_type_node, op0, op1)); + finish_omp_atomic (OMP_ATOMIC_CODE (t), op0, op1); } break; @@ -12473,7 +12470,8 @@ dependent_scope_ref_p (tree expression, bool criterion (tree)) } /* Returns TRUE if the EXPRESSION is value-dependent, in the sense of - [temp.dep.constexpr] */ + [temp.dep.constexpr]. EXPRESSION is already known to be a constant + expression. */ bool value_dependent_expression_p (tree expression) @@ -12564,32 +12562,10 @@ value_dependent_expression_p (tree expression) || value_dependent_expression_p (TREE_OPERAND (expression, 1))); case CALL_EXPR: - /* A CALL_EXPR is value-dependent if any argument is - value-dependent. Why do we have to handle CALL_EXPRs in this - function at all? First, some function calls, those for which - value_dependent_expression_p is true, man appear in constant - expressions. Second, there appear to be bugs which result in - other CALL_EXPRs reaching this point. */ - { - tree function = TREE_OPERAND (expression, 0); - tree args = TREE_OPERAND (expression, 1); - - if (value_dependent_expression_p (function)) - return true; - - if (! args) - return false; - - if (TREE_CODE (args) == TREE_LIST) - { - for (; args; args = TREE_CHAIN (args)) - if (value_dependent_expression_p (TREE_VALUE (args))) - return true; - return false; - } - - return value_dependent_expression_p (args); - } + /* A CALL_EXPR may appear in a constant expression if it is a + call to a builtin function, e.g., __builtin_constant_p. All + such calls are value-dependent. */ + return true; default: /* A constant expression is value-dependent if any subexpression is -- cgit v1.1