Hi again,
Thus, what to do? Definitely adding CAST_EXPR to the switch works, but
I'm wondering if we could do something else... but doesn't seem easy
to me given the above. For example, I suppose changing
potential_constant_expression to return true for error_mark_node would
be catastrophic, even if error_mark_node is definitely constant ;)
Thus I decided to do the experiment: the below passes the testsuite, eh!
Interestingly the tweak to the testcase below *align* the error messages
produced to those produced with -std=c++98, just a little more terse.
Thus, is my idea really crazy after all? (of course, given the analysis
in the previous message, c++/51225 is also fixed)
Thanks,
Paolo.
/////////////////
Index: testsuite/g++.dg/cpp0x/regress/error-recovery1.C
===================================================================
--- testsuite/g++.dg/cpp0x/regress/error-recovery1.C (revision 181678)
+++ testsuite/g++.dg/cpp0x/regress/error-recovery1.C (working copy)
@@ -5,7 +5,7 @@ template < bool > void
foo ()
{
const bool b =; // { dg-error "" }
- foo < b > (); // { dg-error "constant expression" }
+ foo < b > ();
};
// { dg-error "no match" "" { target *-*-* } 8 }
Index: cp/semantics.c
===================================================================
--- cp/semantics.c (revision 181678)
+++ cp/semantics.c (working copy)
@@ -7923,9 +7923,7 @@ potential_constant_expression_1 (tree t, bool want
if (cxx_dialect < cxx0x)
return true;
- if (t == error_mark_node)
- return false;
- if (t == NULL_TREE)
+ if (t == NULL_TREE || t == error_mark_node)
return true;
if (TREE_THIS_VOLATILE (t))
{