-
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"diverges-from:edgDoes the clang frontend diverge from edg compiler on this issueDoes the clang frontend diverge from edg compiler on this issuediverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue
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
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:edgDoes the clang frontend diverge from edg compiler on this issueDoes the clang frontend diverge from edg compiler on this issuediverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue