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
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/0648b8706f3f23996ea1c4c6d561b3efb3ca1e81 Fix issue 17276 added additional case for objects that do not have as root class Object. https://github.com/dlang/phobos/commit/da299506766d39910e01d130aad783f5e76ec10b Merge pull request #6724 from aermicioi/master Fix issue 17276 added additional case for objects that do not have as root class Object. merged-on-behalf-of: Nathan Sashihara <[email protected]>