-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"
Description
Clang 16 fails to compile the following program due to malformed default function argument:
template <typename U>
int fun(U u = U::value);
template <class T>
decltype(fun<T>()) test(int) { return 2; }
template<class>
int test(long) { return 3; }
int main() {
return test<int>(0);
}
GCC and MSVC compile the program that returns value 3. ICX exposes the same behavior as Clang. I would expect the GCC behavior.
- Either the formation of the default function argument is not in the immediate context, and in this case there is no need to form the value: it should be enough to say that some default value would be produced (program would return 2),
- Or it should be in the immediate context, and in this case the program should correctly diagnose that
fun<T>()
is invalid expression, substitution should fail, and the program should return 3.
Or am I mising something here?
ckwastra
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"