Bug 17276 – BaseClassesTuple fails on extern C++ classes that implement an interface without a base class
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2017-03-25T11:16:25Z
Last change time
2018-10-01T23:15:05Z
Assigned to
No Owner
Creator
alexandru.ermicioi
Comments
Comment #0 by alexandru.ermicioi — 2017-03-25T11:16:25Z
Given following code:
extern (C++) {
interface Ext {
void someext();
}
class E : Ext {
void someext() {
}
}
}
void main() {
import std.traits;
pragma(msg, BaseClassesTuple!E);
}
The resulting error is:
phobos/std/traits.d(3798,24): Error: template instance std.traits.BaseClassesTuple!(Ext) does not match template declaration BaseClassesTuple(T) if (is(T == class))
BaseClassesTuple will fail to get list of base classes, incorrectly treating Ext interface as a class.
It seems BaseClassesTuple was designed to be used only on D classes that are guaranteed to extend Object class.
Comment #1 by github-bugzilla — 2018-10-01T23:15:04Z