... the patch ;) Paolo.
Fix "PR c++/94034 Broken diagnostic: 'result_decl' not supported by dump_expr" A rather simple diagnostic issue where we failed to handle RESULT_DECL in dump_expr. Tested x86_64-linux. /cp PR c++/94034 * error.c (dump_expr): Handle RESULT_DECL like the other *_DECL. /testsuite PR c++/94034 * g++.dg/cpp0x/pr94034.C: New.
diff --git a/gcc/cp/error.c b/gcc/cp/error.c index cc51b6ffe13..c1392bcbb25 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -2102,6 +2102,7 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags) case OVERLOAD: case TYPE_DECL: case IDENTIFIER_NODE: + case RESULT_DECL: dump_decl (pp, t, ((flags & ~(TFF_DECL_SPECIFIERS|TFF_RETURN_TYPE |TFF_TEMPLATE_HEADER)) | TFF_NO_TEMPLATE_BINDINGS diff --git a/gcc/testsuite/g++.dg/cpp0x/pr94034.C b/gcc/testsuite/g++.dg/cpp0x/pr94034.C new file mode 100644 index 00000000000..0a828c1e263 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr94034.C @@ -0,0 +1,10 @@ +// { dg-do compile { target c++11 } } + +struct A { A *ap = this; }; +constexpr A foo() { + return {}; +} +void g() { + constexpr A a = foo(); // { dg-bogus "not supported by" } + // { dg-error "not a constant expression" "" { target c++11 } .-1 } +}