Open llvmbot opened 6 years ago
However, g++ compiles the above code without any errors. Is this a problem of clang or gcc?
No, this is a language extension in both compilers, and the two compilers have somewhat different extensions. Clang tries to make its C++ compound-literal extension match C compound-literals, whereas GCC defines (T){...}
as being the same as T{...}
.
However, being more GCC-compatible here seems like it might be a good thing, since C doesn't have references.
@llvm/issue-subscribers-clang-frontend
Author: None (llvmbot)
Extended Description
The test code is as follow:
clang++ produces an error message:
However, g++ compiles the above code without any errors. Is this a problem of clang or gcc?