Open
Description
The following valid program is rejected by Clang:
template<typename T1, int T2 = 0>
struct tuple {};
template<typename... Args>
tuple<Args...> foo(){
return tuple<Args...>{};
}
int main()
{
foo<int>();
}
The code can normally compile if the default template parameter of tuple
does not exist.
GCC, MSVC, and EDG all accept it.
clang rejects it with:
<source>:11:3: error: no matching function for call to 'foo'
11 | foo<int>();
| ^~~~~~~~
<source>:5:16: note: candidate template ignored: substitution failure [with Args = <int>]: template argument for non-type template parameter must be an expression
5 | tuple<Args...> foo(){
| ~~~~~ ^
1 error generated.
Please see https://godbolt.org/z/6h8vWx47x