requires{ member_fn; } within a member function is true, despite member_fn; being an error (original) (raw)

Bugzilla Link 51904
Version trunk
OS Linux
Attachments Test case for requires{} expressions
CC @zygoloid

Extended Description

If I define a class with a void member_fn() which contains requires{ member_fn; }, it evaluates to true on Clang but is an error on GCC, despite member_fn; being an error on both compilers.

If I define a template<typename T> Class : T instantiated with a T containing base_fn(), and Class contains a member function with requires{ T::base_fn; }, it evaluates to true on Clang but false on GCC, despite base_fn; being an error on both compilers.

Is this a Clang bug, or is my code ill-formed? I was using the value of requires{} as an input to if constexpr or static_assert, rather than as a concept or template bound; is this allowed?

I've attached a file testing whether requires{} in various positions is true, false, or an error to evaluate.