[llvm-bugs] [Bug 27494] New: C++ Member access control in explicit template instantiations not working

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Apr 23 10:21:13 PDT 2016


            Bug ID: 27494
           Summary: C++ Member access control in explicit template
                    instantiations not working
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bugfinder1 at gmx.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

These private member functions fail to compile when used as an argument of an
explicit template instantiation:
    - overloaded functions
    - static overloaded functions
    - templated functions

Consider the following code:

struct A
    int func(int x) { return x; }   // overloaded
    int func(char x) { return x; }  // overloaded

    template <typename T>
    int funcT(T x) { return x; } // templated

template<int (A::*member)(int)>
struct B

template struct B<&A::func>;
template struct B<&A::funcT<int>>;

int main()
    return 0;

The C++ standard states in 14.7.2/12 [temp.explicit]:

    The usual access checking rules do not apply to names used to specify
explicit instantiations. [ Note: In particular, the template arguments and
names used in the function declarator (including parameter types, return types
and exception specifications) may be private types or objects which would
normally not be accessible and the template may be a member template or member
function which would not normally be accessible. — end note ]

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/20160423/dcdee06d/attachment-0001.html>

More information about the llvm-bugs mailing list