#include <typeinfo>

class I {
public:
    virtual ~I() { }
    virtual void x() { }
};

class A : public I {
    void x() override { }
};

class B : public I {
    void x() override { }
};

int main() {
    I *a = new A();
    B *b = dynamic_cast<B *>(a);
    (void)b;
    delete a;
    return 0;
}

#include <typeinfo>

class A {
    virtual void x() { }
};

class B : public A {
    void x() override { }
};

int main() {
    A a;
    B *b = dynamic_cast<B *>(&a);
    (void)b;
    return 0;
}

--- 
+++ 
@@ -1,16 +1,23 @@
 #include <typeinfo>
 
-class A {
+class I {
+public:
+    virtual ~I() { }
     virtual void x() { }
 };
 
-class B : public A {
+class A : public I {
+    void x() override { }
+};
+
+class B : public I {
     void x() override { }
 };
 
 int main() {
-    A a;
-    B *b = dynamic_cast<B *>(&a);
+    I *a = new A();
+    B *b = dynamic_cast<B *>(a);
     (void)b;
+    delete a;
     return 0;
 }
Fix enableRtti test with GCC.

GCC is stricter than Clang/MSVC and fails to compile certain provably
meaningless constructs like dynamic_casts that will never succeed.

Change-Id: I5e1a5c965395f218c4dd6340b761c308fe41282f
Reviewed-by: Christian Kandeler <3aa99dcdd3f0cac61fb81c2a11771c0cc2497607@theqtcompany.com>
