Created attachment 8228 [details] The (meta)program clang r153011 segfaults without assertion when compiling the attached program using libc++ r152981.
Created attachment 8229 [details] Log of gdb session with clang Debug+Assert
Smaller testcase: struct S { template<typename T> constexpr static T f(T k) { return g(k); } template<typename T> constexpr static T g(T k) { return k ? f(k-1) : 0; } }; constexpr int n = S().f(1); While instantiating f, we mark g as referenced and try to instantiate it. While instantiating g, we mark f as referenced, don't notice we're already in the middle of instantiating it, and try to instantiate it again. We should accept this code, but should reject similar code where the mutually recursive calls between f and g occur in locations where a constant expression is required.
*** Bug 13085 has been marked as a duplicate of this bug. ***
Fixed in r280190.