Since C++20 lambda functions are allowed in unevaluated contexts, and in particular they should be allowed inside decltype and sizeof expressions.
In its turn, lambdas can define some types in their bodies and possible return objects of these types, for example:
using T = decltype( []{ struct S{}; return S{}; } );
[[maybe_unused]] constexpr auto N
= sizeof( []{ struct S{}; return S{}; } );
Clang accepts this code, but GCC emits the errors:
error: types may not be defined in 'decltype' expressions
1 | using T = decltype( []{ struct S{}; return S{}; } );
error: types may not be defined in 'sizeof' expressions
4 | = sizeof( []{ struct S{}; return S{}; } );
Demo: https://gcc.godbolt.org/z/9aY1KWfbq
Which one of the compilers is right here?