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

             Bug #: 12758
           Summary: miscompilation of calls to __attribute__((pure))
                    virtual functions
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified


Consider this code:

struct B { virtual void f() __attribute__((pure)); };
struct D : B { void f(); };
void f(B *p) { p->f(); }
void g() { D b; f(&b); }

Here, B::f() is __attribute__((pure)), but D::f() is not. g++ emits a virtual
call within ::f(), but Clang does not. Likewise, g++ emits a call to D::f()
within ::g(), but Clang does not.

The GCC docs don't explicitly state what should happen here, but they do say
that 'pure' is a property of the function itself, which suggests that g++ is
right and clang is wrong.

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to