https://bugs.llvm.org/show_bug.cgi?id=47684

            Bug ID: 47684
           Summary: crash after hiding of class-scope using shadow
                    declaration in a template
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: richard-l...@metafoo.co.uk
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

Testcase causes a broken AST and a crash in IR generation:

struct A {
    void f();
};
template<typename T> struct B : A {
    using A::f;
    static constexpr auto p = &B::f;
    void f();
};
auto v = B<int>::p;

The problem is that we inject a using shadow declaration for 'using A::f', and
then try to retroactively remove it (after it was already used) when we see the
later declaration of the member 'void f()'. Then during template instantiation,
we don't instantiate the using-shadow declaration (it was already removed), so
the '&B::f' has nothing to refer to.

Perhaps the best thing to do would be to reject any case where the
UsingShadowDecl is referenced before being hidden (on the basis that this is a
"reordering the declarations changes the meaning of the class" case).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to