re PR c++/77482 (Segfault when compiling ill-formed constexpr code)

PR c++/77482
	* error.c (dump_simple_decl): Only check DECL_DECLARED_CONCEPT_P
	if DECL_LANG_SPECIFIC is non-NULL.  Fix up formatting.

	* g++.dg/cpp0x/constexpr-77482.C: New test.

From-SVN: r240198
This commit is contained in:
Jakub Jelinek 2016-09-16 22:25:17 +02:00 committed by Jakub Jelinek
parent e80cb545aa
commit 8f03e02f36
4 changed files with 20 additions and 8 deletions

View File

@ -1,5 +1,9 @@
2016-09-16 Jakub Jelinek <jakub@redhat.com>
PR c++/77482
* error.c (dump_simple_decl): Only check DECL_DECLARED_CONCEPT_P
if DECL_LANG_SPECIFIC is non-NULL. Fix up formatting.
PR c++/77338
* constexpr.c (cxx_eval_constant_expression) <case PARM_DECL>: Only
call is_really_empty_class on complete types.

View File

@ -959,14 +959,13 @@ dump_simple_decl (cxx_pretty_printer *pp, tree t, tree type, int flags)
{
if (flags & TFF_DECL_SPECIFIERS)
{
if (VAR_P (t)
&& DECL_DECLARED_CONSTEXPR_P (t))
{
if (DECL_DECLARED_CONCEPT_P (t))
pp_cxx_ws_string (pp, "concept");
else
pp_cxx_ws_string (pp, "constexpr");
}
if (VAR_P (t) && DECL_DECLARED_CONSTEXPR_P (t))
{
if (DECL_LANG_SPECIFIC (t) && DECL_DECLARED_CONCEPT_P (t))
pp_cxx_ws_string (pp, "concept");
else
pp_cxx_ws_string (pp, "constexpr");
}
dump_type_prefix (pp, type, flags & ~TFF_UNQUALIFIED_NAME);
pp_maybe_space (pp);
}

View File

@ -1,5 +1,8 @@
2016-09-16 Jakub Jelinek <jakub@redhat.com>
PR c++/77482
* g++.dg/cpp0x/constexpr-77482.C: New test.
PR c++/77379
* g++.dg/abi/abi-tag23.C: Adjust scan-assembler regex for differing
thunk offsets.

View File

@ -0,0 +1,6 @@
// PR c++/77482
// { dg-do compile { target c++11 } }
constexpr auto x; // { dg-error "declaration\[^\n\r]*has no initializer" }
extern struct S s;
constexpr auto y = s; // { dg-error "has incomplete type" }