New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clang-cl: complains 'inheritance model does not match definition' #20361
Comments
assigned to @majnemer |
Here's a slightly saner reduction: class A {}; C p; |
As a workaround, you can do this: class A {}; Our diagnostic is bad, but here's what's happening:
|
Thanks a lot for the analysis and workaround, Reid! I'll try to work with Jeff tomorrow to see how we can apply this workaround to our code. I have to admit that I don't entirely understand the implications of these MSVC keywords (I just learned about their existence yesterday.) I assume the workaround won't change how the code will behave when built with cl? |
marginally reduced: |
Fixed in r210886. |
I should point out that while we have fixed this in clang, note that sizeof(mCallOnResume) will probably be 16 (1 pointer and 3 ints!) on x86 with both MSVC and Clang. That's probably larger than you wanted. The __multiple_inheritance workaround that I gave should make it just 8 (1 pointer and 1 int). |
It seems the fix is not 100% correct. code (simplified) : clang output: |
József, I cannot reproduce with what you have posted. Please provide a complete example. |
Extended Description
Clang fails to compile the following code that succeeds with cl.exe
class A {};
template class B {
void (T::*mCallOnResume)();
};
namespace q {
class C : A, B {
};
};
The text was updated successfully, but these errors were encountered: