[Issue 17276] New: BaseClassesTuple fails on extern C++ classes that implement an interface without a base class
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Sat Mar 25 04:16:25 PDT 2017
    
    
  
https://issues.dlang.org/show_bug.cgi?id=17276
          Issue ID: 17276
           Summary: BaseClassesTuple fails on extern C++ classes that
                    implement an interface without a base class
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: alexandru.ermicioi at gmail.com
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.
--
    
    
More information about the Digitalmars-d-bugs
mailing list