Commit 9b7be7b5 by Mark Mitchell Committed by Mark Mitchell

re PR c++/14369 (errenous reject of well-formed code)

	PR c++/14369
	* 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.

From-SVN: r78746
parent fdf89bf5
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
......
......@@ -12113,6 +12113,13 @@ build_non_dependent_expr (tree expr)
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.
......
// 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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment