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

            Bug ID: 41078
           Summary: Availability attribute incorrectly triggers when
                    during instantiation of template from an unavailable
                    context
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: ldio...@apple.com
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@metafoo.co.uk

The following program produces an error saying that 'A' is unavailable:

    $ cat <<EOF | clang++ -xc++ -std=c++2a - -fsyntax-only
    template <class T>
    struct Inherit : private T {
       Inherit() = default;
    };

    #pragma clang attribute
push(__attribute__((availability(macosx,strict,unavailable))),
apply_to=any(function,record))
    struct A { A() { } };
    struct B { B() { Inherit<A> xx; } };
    #pragma clang attribute pop
    EOF

The error is (after applying https://reviews.llvm.org/D59394):

    <stdin>:3:4: error: 'A' is unavailable: not available on macOS
       Inherit() = default;
       ^
    <stdin>:8:29: note: in implicit default constructor for 'Inherit<A>' first
required here
    struct B { B() { Inherit<A> xx; } };
                                ^
    <stdin>:7:12: note: 'A' has been explicitly marked unavailable here
    struct A { A() { } };
               ^

Basically, it looks as though we don't see that `Inherit<A>` is being
instantiated from an unavailable context, and so that we shouldn't trigger an
availability error for using `A`.

-- 
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