diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2018-10-08 09:02:55 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2018-10-08 09:02:55 +0000 |
commit | a52cdecf114f4f1e5acbdeeb28b9381875a4b9a8 (patch) | |
tree | 2d1e1335e6af3dee80183799a50299e9c986b4ea | |
parent | 8656dafa39de8e537940433220e8f5db3bf7a614 (diff) | |
download | gcc-a52cdecf114f4f1e5acbdeeb28b9381875a4b9a8.zip gcc-a52cdecf114f4f1e5acbdeeb28b9381875a4b9a8.tar.gz gcc-a52cdecf114f4f1e5acbdeeb28b9381875a4b9a8.tar.bz2 |
re PR c++/71128 ([concepts] ICE on ill-formed explicit instantiation of a function concept)
/cp
2018-10-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/71128
* pt.c (do_decl_instantiation): Per 12.6.8/5, a concept cannot be
explicitly instantiated.
/testsuite
2018-10-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/71128
* g++.dg/concepts/pr71128.C: New.
From-SVN: r264914
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/concepts/pr71128.C | 10 |
4 files changed, 29 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 97d7e8d..9a0a5ea 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-10-08 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/71128 + * pt.c (do_decl_instantiation): Per 12.6.8/5, a concept cannot be + explicitly instantiated. + 2018-10-05 David Malcolm <dmalcolm@redhat.com> PR c++/56856 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index b8b6545..aced6f2 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -23127,6 +23127,14 @@ do_decl_instantiation (tree decl, tree storage) error ("explicit instantiation of non-template %q#D", decl); return; } + else if (DECL_DECLARED_CONCEPT_P (decl)) + { + if (VAR_P (decl)) + error ("explicit instantiation of variable concept %q#D", decl); + else + error ("explicit instantiation of function concept %q#D", decl); + return; + } bool var_templ = (DECL_TEMPLATE_INFO (decl) && variable_template_p (DECL_TI_TEMPLATE (decl))); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7b8bdc7..5a9141d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-10-08 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/71128 + * g++.dg/concepts/pr71128.C: New. + 2018-10-08 Richard Sandiford <richard.sandiford@arm.com> PR c/87286 diff --git a/gcc/testsuite/g++.dg/concepts/pr71128.C b/gcc/testsuite/g++.dg/concepts/pr71128.C new file mode 100644 index 0000000..8b4eb41 --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/pr71128.C @@ -0,0 +1,10 @@ +// { dg-do compile { target c++14 } } +// { dg-additional-options "-fconcepts" } + +template<typename T> +concept bool C() { return true; } +template bool C<int>(); // { dg-error "explicit instantiation of function concept" } + +template<typename T> +concept bool D = true; +template bool D<int>; // { dg-error "explicit instantiation of variable concept" } |