Improper resolution of constraint requirements when using CRTP #47418
Labels
bugzilla
Issues migrated from bugzilla
c++20
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
duplicate
Resolved as duplicate
Extended Description
Using libstdc++'s header with clang 11 doesn't compile even the most basic examples:
#include
auto w = std::views::iota(0);
The failure reduces to the following:
template T declval();
template using begin_t = decltype(declval<T&>().begin());
template concept C = true;
template
struct simple_view_interface
{
auto also_begin() requires
#ifdef TYPE_TRAIT
C<begin_t>
#else
requires (D d) { {d.begin()} -> C; }
#endif
{
return static_cast<D&>(*this).begin();
}
};
struct wat_view : simple_view_interface<wat_view>
{
auto begin() -> int* { return nullptr; }
};
auto w = wat_view().also_begin();
Both spellings of the requirement on also_begin() should be equivalent, and should be valid in this case. The checking of the requirements should be deferred until instantiation, at which point, wat_view is complete.
If TYPE_TRAIT is defined, the requirement is eagerly instantiated, an even the definition of wat_view fails to compile:
The text was updated successfully, but these errors were encountered: