https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67150
Bug ID: 67150 Summary: [c++-concepts] Expression constraint fails with dependent types Product: gcc Version: c++-concepts Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: Casey at Carter dot net Target Milestone: --- r226725 fails to compile this program: #include <type_traits> template <class From, class To> concept bool ExplicitlyConvertible = requires (From&& val) { requires std::is_same<From,bool>::value; requires std::is_same<To,bool>::value; requires std::is_same<decltype(val),bool&&>::value; static_cast<bool>((bool&&)val); // Line 9 static_cast<To>((From&&)val); // Line 10 }; template <class T> concept bool Boolean = requires (const T& t) { { t } -> ExplicitlyConvertible<bool>; }; constexpr bool f(Boolean) { return true; } // Line 19 static_assert(f(true)); // Line 20 with error: ~/concept-gcc-r226725/bin/g++ -std=gnu++1z foo.cpp -c foo.cpp:20:21: error: cannot call function ‘constexpr bool f(auto:1) [with auto:1 = bool]’ static_assert(f(true)); // Line 20 ^ foo.cpp:19:16: note: constraints not satisfied constexpr bool f(Boolean) { return true; } // Line 19 ^ foo.cpp:19:16: note: concept ‘Boolean<bool>’ was not satisfied It does compile correctly if line 10 is commented out, demonstrating that the expression "static_cast<To>((From&&)val)" is causing the constraint dissatisfaction despite the fact that From is bool, To is bool, and "static_cast<bool>((bool&&)val)" is acceptable.