-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Closed
Labels
accepts-invalidclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partygood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute
Description
The following code is apparently illegal, as the declaration of A(A<V,T>)
should be treated as a copy constructor, which forces passing the argument by reference. While clang ignores that error and accepts it:
template < class T, class V > struct A
{
A ();
A (A &);
A (A < V,T >);
};
void f ()
{
A <int, int> (A < int, int >());
}
Note that if replace A<V,T>
with A<T,T>
or A<V,V>
, the code is still accepted. But when replacing it with A<T,V>
, the code is correctly rejected.
Reducing the number of template class arguments to 1 (template <class T> A
and A(A<T>)
) also makes sense. We suspect the bug will occur only if the template argument list in copy ctor parameter is not identical to that in class declaration.
Metadata
Metadata
Assignees
Labels
accepts-invalidclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partygood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute