https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127489
Bug ID: 127489
Summary: Dependent __builtin_structured_binding_size in
decltype is diagnosed before instantiation
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: bic60176 at gmail dot com
Target Milestone: ---
template <typename U,
typename = decltype(__builtin_structured_binding_size(U))>
int probe(int)
{
return 1;
}
template <typename U>
int probe(long)
{
return 0;
}
struct P {
int x;
int y;
};
int main()
{
return probe<P>(0) == 1 && probe<int>(0) == 0 ? 0 : 1;
}
g++ -std=c++26 test.cc -o test
Actual: GCC immediately diagnoses cannot decompose non-array non-class type
'U'.
Expected: the expression should remain dependent. For int, substitution should
fail and select the fallback overload.