From: Jason Merrill Date: Wed, 4 Apr 2018 16:42:50 +0000 (-0400) Subject: PR c++/85133 - ICE with missing concept initializer. X-Git-Tag: basepoints/gcc-9~336 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6173fb512fca3ae6595c584e9af3765400c5a3de;p=thirdparty%2Fgcc.git PR c++/85133 - ICE with missing concept initializer. * decl.c (cp_finish_decl): If a concept initializer is missing, use true. From-SVN: r259091 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f0927e82b36d..0f857449b8f0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2018-04-04 Jason Merrill + PR c++/85133 - ICE with missing concept initializer. + * decl.c (cp_finish_decl): If a concept initializer is missing, use + true. + PR c++/85118 - wrong error with generic lambda and std::bind. * call.c (add_template_conv_candidate): Disable if there are any call operators. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index c8ae72faeae1..1cc2cd16ccc1 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7010,7 +7010,10 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, if (!VAR_P (decl) || type_dependent_p) /* We can't do anything if the decl has dependent type. */; else if (!init && is_concept_var (decl)) - error ("variable concept has no initializer"); + { + error ("variable concept has no initializer"); + init = boolean_true_node; + } else if (init && init_const_expr_p && TREE_CODE (type) != REFERENCE_TYPE diff --git a/gcc/testsuite/g++.dg/concepts/var-concept7.C b/gcc/testsuite/g++.dg/concepts/var-concept7.C new file mode 100644 index 000000000000..0df4a498a0dd --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/var-concept7.C @@ -0,0 +1,8 @@ +// PR c++/85133 +// { dg-additional-options "-std=c++17 -fconcepts" } + +template concept bool C; // { dg-error "no initializer" } + +template struct A {}; + +A a;