[llvm-bugs] [Bug 42366] constexpr pointer to data member conversion issue

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 23 22:58:47 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42366

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
The stackoverflow answer quotes the relevant wording:

"""
A prvalue of type “pointer to member of D of type cv1 T” can be converted to a
prvalue of type “pointer to member of B of type cv2 T”, where B is a base class
of D, if cv2 is the same cv-qualification as, or greater cv-qualification than,
cv1. […] If class B contains the original member, or is a base or derived class
of the class containing the original member, the resulting pointer to member
points to the original member. Otherwise, the behavior is undefined.
"""

Here, D is Derived and B is Base. The original member is Data::foo. B does not
contain Data::foo, and is neither a base or derived class of the class
containing the original member (Data), so behavior is undefined, so the
evaluation is non-constant.

-- 
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/20190624/3c70c0bc/attachment-0001.html>


More information about the llvm-bugs mailing list