diff options
author | Jason Merrill <jason@redhat.com> | 2018-04-04 12:42:50 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2018-04-04 12:42:50 -0400 |
commit | 6173fb512fca3ae6595c584e9af3765400c5a3de (patch) | |
tree | 0b7f18be6429c1861b75631f0270c633de9d413d /gcc | |
parent | bd40bc8ea3f1eff8c2f211000dd9062f1785a5e4 (diff) | |
download | gcc-6173fb512fca3ae6595c584e9af3765400c5a3de.zip gcc-6173fb512fca3ae6595c584e9af3765400c5a3de.tar.gz gcc-6173fb512fca3ae6595c584e9af3765400c5a3de.tar.bz2 |
PR c++/85133 - ICE with missing concept initializer.
* decl.c (cp_finish_decl): If a concept initializer is missing, use
true.
From-SVN: r259091
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/decl.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/concepts/var-concept7.C | 8 |
3 files changed, 16 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f0927e8..0f85744 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2018-04-04 Jason Merrill <jason@redhat.com> + 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 c8ae72f..1cc2cd1 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 0000000..0df4a49 --- /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<typename> concept bool C; // { dg-error "no initializer" } + +template<C...> struct A {}; + +A<int> a; |