-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
Consider
template<typename T, typename F = decltype([](){} )>
struct Type {};
template<typename A>
using C = Type<A>;
static_assert(std::same_as<Type<int>,Type<int>>); // #1
static_assert(std::same_as<C<int>,C<int>>); // #2https://godbolt.org/z/6ofdP1bPz
All compilers reject #1. Only clang rejects #2.
This seems vaguely related, but distinct from CWG2794
Given https://eel.is/c++draft/temp.alias#2
When a template-id refers to the specialization of an alias template, it is equivalent to the associated type obtained by substitution of its template-arguments for the template-parameters in the defining-type-id of the alias template.
And https://eel.is/c++draft/temp#arg.general-9.sentence-1
When a simple-template-id does not name a function, a default template-argument is implicitly instantiated when the value of that default argument is needed.
It's clear as mud (to me) what the expected behavior should be.
CWG discussion https://lists.isocpp.org/core/2025/01/16895.php