diff options
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/concepts/pr71368.C | 25 |
2 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f344a46..3da50bf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 0000000..f0e0a95 --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/pr71368.C @@ -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> ); +} |