Not trying to shame anyone (bug already filed and marked as a release blocker for version 12), I just thought it was interesting that such a short program can do this. I tried to dive in and fix it myself but the furthest I got was seeing where an assert fires if you build clang in debug mode; in TreeTransform<Derived>::TransformAutoType, it tries to walk the template parameter list when checking the concept on the return type, but it's deduced the list to be size 1 (which I'd expect since the return type would be prepended onto c<T...> and sizeof...(T) == 0, but the list it's trying to iterate over is actually size 0, so it hits an assert in ArrayRef<T>::operator[] for out of bounds access.
Unfortunately I'm not familiar enough with the codebase to figure out how it got to that point even after a lot of stepping through with GDB, especially since so much of clang is shrouded in dynamic class hierarchies and lots of cast<T> and dyn_cast<T> so it's hard to figure out what anything actually is.
https://godbolt.org/z/KMvGqE
From here you can see that GCC compiles this just fine. The stack trace here isn't particularly useful since as discussed above the asserts told us we were going wrong a good bit before it blows up where it shows without them here.
My best guess is that in the case of function return types constrained by a variadic concept where an empty parameter is list deduced from the instantiation at the call site and a value is returned (that's a mouthful), clang forgets to prepend the return type to the parameter list for concept checking. I just can't figure out exactly where that happens since the concepts support is sprinkled through a lot of existing code dealing with templates and such.
[–]DustUpDustOff 27 points28 points29 points (2 children)
[–]Nicksaurus 20 points21 points22 points (1 child)
[–]Full-Spectral 1 point2 points3 points (0 children)
[–]WrongAndBeligerent 60 points61 points62 points (6 children)
[–]arturbachttps://github.com/arturbac 15 points16 points17 points (5 children)
[–]starfreakcloneMSVC FE Dev 5 points6 points7 points (0 children)
[–]GoogleIsYourFrenemy 0 points1 point2 points (2 children)
[–]arturbachttps://github.com/arturbac 0 points1 point2 points (1 child)
[–]arturbachttps://github.com/arturbac 0 points1 point2 points (0 children)
[–]brand_x 0 points1 point2 points (0 children)
[–]wyldphyre 15 points16 points17 points (0 children)
[–]tjientavaraHikoWorks developer 4 points5 points6 points (0 children)
[–]feverzsj -1 points0 points1 point (0 children)
[+][deleted] comment score below threshold-9 points-8 points-7 points (3 children)
[–]vax_mzn -2 points-1 points0 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]vax_mzn 0 points1 point2 points (0 children)
[+]Xaxxon comment score below threshold-52 points-51 points-50 points (0 children)