Should the following program be rejected? Clang seems to accept it.
template<typename T>
concept c = requires { T::n; };
struct z;
constexpr bool b(auto...) { return c<z>; }
struct z { int n; };
static_assert(not b()); // clang ok, gcc nope, msvc nope
By the time b()
is evaluated, template b
has been implicitly stamped out, and type z
is then complete. However, the expression c<z>
within b
doesn't depend on any of b
's template parameters. So, I guess the question boils down to whether c<z>
should be resolved when template b
is defined or when it is being instantiated.
c<struct incomplete>
should just resolve to false. (Although, MSVC seems to reject this due to some other bug.) – Refutation