* pt.c (build_non_dependent_expr): Do not create a
NON_DEPENDENT_EXPR for a THROW_EXPR.
PR c++/14369
* g++.dg/template/cond4.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@78746
138bc75d-0d04-0410-961f-
82ee72b054a4
+2004-03-01 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/14369
+ * pt.c (build_non_dependent_expr): Do not create a
+ NON_DEPENDENT_EXPR for a THROW_EXPR.
+
2004-03-01 Gabriel Dos Reis <gdr@integrable-solutions.net>
PR c++/14369
reason to create a new node. */
if (TREE_CODE (expr) == INTEGER_CST || TREE_CODE (expr) == REAL_CST)
return expr;
+ /* Preserve THROW_EXPRs -- all throw-expressions have type "void".
+ There is at least one place where we want to know that a
+ particular expression is a throw-expression: when checking a ?:
+ expression, there are special rules if the second or third
+ argument is a throw-expresion. */
+ if (TREE_CODE (expr) == THROW_EXPR)
+ return expr;
if (TREE_CODE (expr) == COND_EXPR)
return build (COND_EXPR,
2004-03-01 Mark Mitchell <mark@codesourcery.com>
+ PR c++/14369
+ * g++.dg/template/cond4.C: New test.
+
+2004-03-01 Mark Mitchell <mark@codesourcery.com>
+
PR c++/14360
* g++.old-deja/g++.ns/koenig5.C: Remove some error markers.
--- /dev/null
+// PR c++/14369
+
+struct A { };
+
+template<class T>
+struct X : A {
+ const A* bar() const
+ { return this; }
+
+ const A& foo() const;
+};
+
+template<class T>
+const A& X<T>::foo() const
+{
+ const A* t = bar();
+ return *(t ? t : throw 0);
+}
+
+