GCC and EDG reject call using empty braces, to a function with a defaulted template parameter
The following C++ program is rejected by both GCC and EDG, but accepted by Clang and MSVC. Demo. template<unsigned int N = 1> void f1(const int (&)[N]) {} int main() { f1({}); // GCC & EDG reject this; Clang & MSC accept } I want to know which compiler is correct here as per the C++23 standard. GCC says: <source>: In function 'int main()': <source>:5:9: error: no matching function for call to 'f1(<brace-enclosed initializer list>)' 5 | f1({}); //gcc & edg: NO while clang & msvc: Ok | ~~^~~~ • there is 1 candidate • candidate 1: 'template<unsigned int N> void f1(const int (&)[N])' <source>:2:6:
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.