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
This commit is contained in:
Mark Mitchell 2004-03-02 05:47:18 +00:00 committed by Mark Mitchell
parent fdf89bf57c
commit 9b7be7b597
4 changed files with 38 additions and 0 deletions

View File

@ -1,3 +1,9 @@
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

View File

@ -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,

View File

@ -1,3 +1,8 @@
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

View File

@ -0,0 +1,20 @@
// 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);
}