Hi,

another simple issue: here we ICE at the beginning of instantiate_decl when we try to explicitly instantiate a concept. Tested x86_64-linux.

Thanks, Paolo.

/////////////////////

/cp
2018-10-05  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/71128
        * pt.c (do_decl_instantiation): Per 12.6.8/5, a concept cannot be
        explicitly instantiated.

/testsuite
2018-10-05  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/71128
        * g++.dg/concepts/pr71128.C: New.
Index: cp/pt.c
===================================================================
--- cp/pt.c     (revision 264862)
+++ cp/pt.c     (working copy)
@@ -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: testsuite/g++.dg/concepts/pr71128.C
===================================================================
--- testsuite/g++.dg/concepts/pr71128.C (nonexistent)
+++ testsuite/g++.dg/concepts/pr71128.C (working copy)
@@ -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" }

Reply via email to