diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c54a982bc40..a27679f3b02 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2003-11-21 Mark Mitchell + + PR c++/12515 + * pt.c (build_non_dependent_expr): Handle GNU extension to ?: + operator. + 2003-11-21 Jan Hubicka * parser.c (cp_parser_postfix_expression): Initialize 's' to diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 4afe974616d..5b969388a64 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11893,7 +11893,9 @@ build_non_dependent_expr (tree expr) return build (COND_EXPR, TREE_TYPE (expr), TREE_OPERAND (expr, 0), - build_non_dependent_expr (TREE_OPERAND (expr, 1)), + (TREE_OPERAND (expr, 1) + ? build_non_dependent_expr (TREE_OPERAND (expr, 1)) + : build_non_dependent_expr (TREE_OPERAND (expr, 0))), build_non_dependent_expr (TREE_OPERAND (expr, 2))); if (TREE_CODE (expr) == COMPOUND_EXPR && !COMPOUND_EXPR_OVERLOADED (expr)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d14e5ae1b98..73ffd70498c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-11-21 Mark Mitchell + + PR c++/12515 + * g++.dg/ext/cond1.C: New test. + 2003-11-20 Richard Henderson * gcc.dg/20020201-2.c: Remove. diff --git a/gcc/testsuite/g++.dg/ext/cond1.C b/gcc/testsuite/g++.dg/ext/cond1.C new file mode 100644 index 00000000000..ec342121edf --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/cond1.C @@ -0,0 +1,4 @@ +// PR c++/12515 +// { dg-do compile } +// { dg-options "" } +template void foo() { 0 ?: 0; }