Issue 77027
Summary base class of multiple-inherited template class is mistakenly considered as template base class
Labels new issue
Assignees
Reporter nickhuang99
    Considering a template class inherits from multiple classes. The base class should NOT be template-class. This issue is exposed when object tries to access ancestor class member functions. The correct base class should be no template and this is correctly recognized in both [GCC](https://www.godbolt.org/z/MhWevrY89) and [MSVC](https://www.godbolt.org/z/5d8611Pnv).

However, for [clang](https://www.godbolt.org/z/8safdcdoK), there is no error message given indicating both template and non-template base class is considered as ancestor.



Considering a template class inherits from multiple classes. 
`template<typename T, typename ...Ts>`
`class Virus : public T, public Ts... {`
`public:`
    `Virus(const T& t, const Ts&... ts): T(t), Ts(ts)... {;}`
`};`


The base class should NOT be template-class. This issue is exposed when object tries to access ancestor class member functions. 
`Virus<string, vector<int>, map<int, string>> s("1234 is a string", {3,4,5}, {{4, string{"four"}}});`

`cout << s.Virus<vector<int>>::size() << endl;`

The correct base class should be no template and this is correctly recognized in both [GCC](https://www.godbolt.org/z/MhWevrY89) and [MSVC](https://www.godbolt.org/z/5d8611Pnv).
`cout << s.vector<int>::size() << endl;`
However, for [clang](https://www.godbolt.org/z/8safdcdoK), there is no error message given, indicating both template and non-template base class is considered as ancestor.


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to