[LLVMbugs] [Bug 20187] New: vtable layout of __func in <functional> is sensitive to RTTI settings

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 1 18:30:15 PDT 2014


            Bug ID: 20187
           Summary: vtable layout of __func in <functional> is sensitive
                    to RTTI settings
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rnk at google.com
                CC: chandlerc at gmail.com, llvmbugs at cs.uiuc.edu,
                    mclow.lists at gmail.com
    Classification: Unclassified

This segment of <funcitonal> is worrying:
    virtual void destroy_deallocate() _NOEXCEPT;
    virtual _Rp operator()(_ArgTypes&& ... __arg);
    virtual const void* target(const type_info&) const _NOEXCEPT;
    virtual const std::type_info& target_type() const _NOEXCEPT;
#endif  // _LIBCPP_NO_RTTI

What happens if an -frtti and -fno-rtti library both instantiate
std::function<void()> and then link together?

Chandler had some ideas about splitting __func in to __func and __func_rtti
which extends __func.  If RTTI is enabled, we get an always inline
std::function ctor that builds a __func_rtti.  If it is disabled, we get
__func.  Only if we call std::function::target* do we static_cast the __func to
__func_rtti and call the virtual methods.

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/20140702/986e1b61/attachment.html>

More information about the llvm-bugs mailing list