Commit 7433e6d4 by Mark Mitchell Committed by Mark Mitchell

re PR c++/12093 (inconstitent error with templates/non-templates)

2003-08-29  Mark Mitchell  <mark@codesourcery.com>

	PR c++/12093
	* pt.c (build_non_dependent_expr): Do not build a
	NON_DEPENDENT_EXPR for a STRING_CST.

2003-08-29  Mark Mitchell  <mark@codesourcery.com>

	PR c++/12093
	* g++.dg/template/non-dependent4.C: New test.

From-SVN: r70941
parent c2096ef8
2003-08-29 Mark Mitchell <mark@codesourcery.com> 2003-08-29 Mark Mitchell <mark@codesourcery.com>
PR c++/12093
* pt.c (build_non_dependent_expr): Do not build a
NON_DEPENDENT_EXPR for a STRING_CST.
PR c++/11928 PR c++/11928
* search.c (add_conversions): Avoid adding two conversion * search.c (add_conversions): Avoid adding two conversion
operators for the same type. operators for the same type.
......
...@@ -11806,6 +11806,11 @@ build_non_dependent_expr (tree expr) ...@@ -11806,6 +11806,11 @@ build_non_dependent_expr (tree expr)
types. */ types. */
if (TREE_CODE (expr) == OVERLOAD) if (TREE_CODE (expr) == OVERLOAD)
return expr; return expr;
/* Preserve string constants; conversions from string constants to
"char *" are allowed, even though normally a "const char *"
cannot be used to initialize a "char *". */
if (TREE_CODE (expr) == STRING_CST)
return expr;
if (TREE_CODE (expr) == COND_EXPR) if (TREE_CODE (expr) == COND_EXPR)
return build (COND_EXPR, return build (COND_EXPR,
......
2003-08-29 Mark Mitchell <mark@codesourcery.com> 2003-08-29 Mark Mitchell <mark@codesourcery.com>
PR c++/12093
* g++.dg/template/non-dependent4.C: New test.
PR c++/11928 PR c++/11928
* g++.dg/inherit/conv1.C: New test. * g++.dg/inherit/conv1.C: New test.
......
// { dg-options "" }
template<int X> class c;
template<int X, int Y> int test(c<X ? : Y>&);
void test(c<2>*c2) {
test<0, 2>(*c2);
}
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