re PR c++/71128 ([concepts] ICE on ill-formed explicit instantiation of a function...
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 8 Oct 2018 09:02:55 +0000 (09:02 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 8 Oct 2018 09:02:55 +0000 (09:02 +0000)
/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

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/concepts/pr71128.C [new file with mode: 0644]

index 97d7e8d83c33677b7792dd2369eca235e1708f11..9a0a5ea5d3f212aecf4ce4e1162f52feaf6499c1 100644 (file)
@@ -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
index b8b6545434b383d2a666d8b38f95b27a3ab424c4..aced6f2d721cb0f97421dad4c07f11768634f949 100644 (file)
@@ -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)));
index 7b8bdc737668b0ce0e9c51de50dde74b8690e691..5a9141d1623f7215fb0d53f8756ef1f1805a1397 100644 (file)
@@ -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 (file)
index 0000000..8b4eb41
--- /dev/null
@@ -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" }