re PR c++/71368 ([concepts] ICE on constrained compound requirement)
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 17 Oct 2017 19:36:49 +0000 (19:36 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 17 Oct 2017 19:36:49 +0000 (19:36 +0000)
2017-10-17  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/71368
* g++.dg/concepts/pr71368.C: New.

From-SVN: r253826

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/concepts/pr71368.C [new file with mode: 0644]

index f344a46479cebea35a78ba6a77cfb669158f7077..3da50bfe4f102395a38201c184987aacb4ef0ba8 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-17  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/71368
+       * g++.dg/concepts/pr71368.C: New.
+
 2017-10-17  Nathan Sidwell  <nathan@acm.org>
 
        PR c++/82560
diff --git a/gcc/testsuite/g++.dg/concepts/pr71368.C b/gcc/testsuite/g++.dg/concepts/pr71368.C
new file mode 100644 (file)
index 0000000..f0e0a95
--- /dev/null
@@ -0,0 +1,25 @@
+// { dg-options "-std=c++17 -fconcepts" }
+
+struct inner;
+
+template<typename X> concept bool CompoundReq = requires {
+    // fine with concrete type in trailing type, i.e. inner& instead of X&
+    { X::inner_member() } -> X&;
+};
+
+template<typename X> concept bool Concept = requires {
+    { X::outer_member() } -> CompoundReq;
+};
+
+struct inner { static inner& inner_member(); };
+struct outer { static inner outer_member(); };
+
+int main()
+{
+    // fine
+    static_assert( CompoundReq<inner> );
+    static_assert( CompoundReq<decltype( outer::outer_member() )> );
+
+    // ICE
+    static_assert( Concept<outer> );
+}