https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98533

Roman Zhuykov <zhroma at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zhroma at gcc dot gnu.org

--- Comment #9 from Roman Zhuykov <zhroma at gcc dot gnu.org> ---
Just adding another example where I caught the same error:

$ cat test.cc 
class IR;
class Pass {
public:
    explicit Pass(IR *ir) : ir_(ir) {}
    virtual ~Pass() = default;
    IR *ir_ {nullptr};
};
class PassManager {
public:
    template <typename T> void RunPass() { T pass(ir_); }
    IR *ir_ {nullptr};
};
class IR final {
public:                            
    template <typename T> void RunPass() { pass_manager_.RunPass<T>(); }
    PassManager pass_manager_;
};
class ThePass : Pass {
public:
    explicit ThePass(IR *ir) : Pass(ir) {}
    ThePass(const ThePass &) = delete;
    template <typename Func = bool (*)(void *)> void Bar(void *inst, Func func
= [](void *) {});
};

void foo(IR *ir) { ir->RunPass<ThePass>(); }

$ g++ -fchecking -g -c test.cc  # any g++ from 8 to 13
test.cc:18:7: error: type variant has different ‘TYPE_FIELDS’
   18 | class ThePass : Pass {
      |       ^~~~~~~
 <record_type 0x7f44b1bbd738 ThePass ...

Reply via email to