From: Mark Mitchell Date: Sat, 30 Aug 2003 01:42:48 +0000 (+0000) Subject: re PR c++/12093 (inconstitent error with templates/non-templates) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7433e6d47086c63eeee0898963a0173f23c380c9;p=gcc.git re PR c++/12093 (inconstitent error with templates/non-templates) 2003-08-29 Mark Mitchell 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 PR c++/12093 * g++.dg/template/non-dependent4.C: New test. From-SVN: r70941 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b18105fe3e8..d0664230fd2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2003-08-29 Mark Mitchell + PR c++/12093 + * pt.c (build_non_dependent_expr): Do not build a + NON_DEPENDENT_EXPR for a STRING_CST. + PR c++/11928 * search.c (add_conversions): Avoid adding two conversion operators for the same type. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ff3518e069a..6ae091e749c 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11806,6 +11806,11 @@ build_non_dependent_expr (tree expr) types. */ if (TREE_CODE (expr) == OVERLOAD) 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) return build (COND_EXPR, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c057ea2644a..8eeca7e50c3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2003-08-29 Mark Mitchell + PR c++/12093 + * g++.dg/template/non-dependent4.C: New test. + PR c++/11928 * g++.dg/inherit/conv1.C: New test. diff --git a/gcc/testsuite/g++.dg/ext/cond1.C b/gcc/testsuite/g++.dg/ext/cond1.C new file mode 100644 index 00000000000..d17930757d9 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/cond1.C @@ -0,0 +1,10 @@ +// { dg-options "" } + +template class c; + +template int test(c&); + +void test(c<2>*c2) { + test<0, 2>(*c2); +} +