[llvm-bugs] [Bug 41078] New: Availability attribute incorrectly triggers when during instantiation of template from an unavailable context

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 14 17:58:11 PDT 2019


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: unassignedclangbugs at nondot.org
          Reporter: ldionne at apple.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190315/8af5ce9c/attachment.html>


More information about the llvm-bugs mailing list