Open Rush10233 opened 3 months ago
IMO Clang's behavior is more correct here because it delays sema analysis until template instantiation. Technically speaking, Box<int>
is valid. But this can only be determined up on instantiation.
@llvm/issue-subscribers-clang-frontend
Author: None (Rush10233)
Consider the following code:
The constructor of class
Box
in line 5 should be a normal user-defined constructor instead of a copy constructor as the parameter list is incompatible(the real copy ctor should be in the form of that in line 6), so it should not be declared as defaulted. Both GCC and MSVC reject the code, but clang accepts it.MSVC provides the following diagnostic:
Please see https://godbolt.org/z/EbY3zWKc1