[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


http://llvm.org/bugs/show_bug.cgi?id=8058

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

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

    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