[LLVMbugs] [Bug 8058] New: clang permits invalid &Base::ProtectedNonTemplateMemF

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Sep 1 17:39:40 PDT 2010


           Summary: clang permits invalid &Base::ProtectedNonTemplateMemF
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

Created an attachment (id=5441)
 --> (http://llvm.org/bugs/attachment.cgi?id=5441)

The attached testcase is a cute example showing two invalid address-of

    F = &Base::TmpF;
    F = &Base::NonTmpF;

where both TmpF and NonTmpF are protected members, but TmpF is a template and
NonTmpF is not. Neither is static. They should both be rejected, but clang
accepts the &NonTmpF while correctly issuing an error on &TmpF. For amusement,
GCC does the opposite. Comeau correctly flags both as wrong.

A fixit to correct Base to Derived would be even better.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list