summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/tree.c4
-rw-r--r--gcc/cp/typeck.c4
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/template/cond7.C15
5 files changed, 31 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3f7f9dc1fe9..5ff2fa330db 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
2007-11-29 Jakub Jelinek <jakub@redhat.com>
+ PR c++/34270
+ * tree.c (lvalue_p_1) <case COND_EXPR>: Handle x ?: y
+ in templates.
+ * typeck.c (is_bitfield_expr_with_lowered_type) <case COND_EXPR>:
+ Likewise.
+
PR c++/34267
PR c++/34268
* parser.c (cp_parser_decltype): Don't call finish_id_expression
@@ -25,7 +31,7 @@
2007-11-25 Richard Guenther <rguenther@suse.de>
- decl.c (poplevel): Use BLOCK_CHAIN.
+ * decl.c (poplevel): Use BLOCK_CHAIN.
2007-11-24 Ollie Wild <aaw@google.com>
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 6ae05686614..c885d088878 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -160,7 +160,9 @@ lvalue_p_1 (const_tree ref,
break;
case COND_EXPR:
- op1_lvalue_kind = lvalue_p_1 (TREE_OPERAND (ref, 1),
+ op1_lvalue_kind = lvalue_p_1 (TREE_OPERAND (ref, 1)
+ ? TREE_OPERAND (ref, 1)
+ : TREE_OPERAND (ref, 0),
treat_class_rvalues_as_lvalues);
op2_lvalue_kind = lvalue_p_1 (TREE_OPERAND (ref, 2),
treat_class_rvalues_as_lvalues);
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index da46bb35cac..c43eb793584 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1419,7 +1419,9 @@ is_bitfield_expr_with_lowered_type (const_tree exp)
switch (TREE_CODE (exp))
{
case COND_EXPR:
- if (!is_bitfield_expr_with_lowered_type (TREE_OPERAND (exp, 1)))
+ if (!is_bitfield_expr_with_lowered_type (TREE_OPERAND (exp, 1)
+ ? TREE_OPERAND (exp, 1)
+ : TREE_OPERAND (exp, 0)))
return NULL_TREE;
return is_bitfield_expr_with_lowered_type (TREE_OPERAND (exp, 2));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c04a77fb194..1a402116872 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2007-11-29 Jakub Jelinek <jakub@redhat.com>
+ PR c++/34270
+ * g++.dg/template/cond7.C: New test.
+
PR c++/34267
PR c++/34268
* g++.dg/cpp0x/decltype7.C: New test.
diff --git a/gcc/testsuite/g++.dg/template/cond7.C b/gcc/testsuite/g++.dg/template/cond7.C
new file mode 100644
index 00000000000..ce1c77e593b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/cond7.C
@@ -0,0 +1,15 @@
+// PR c++/34270
+// { dg-do compile }
+// { dg-options "" }
+
+void foo ()
+{
+ __typeof__ (0 ?: 0) x;
+ __decltype (0 ?: 0) y;
+}
+
+template<int> void bar ()
+{
+ __typeof__ (0 ?: 0) x;
+ __decltype (0 ?: 0) y;
+}
OpenPOWER on IntegriCloud