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

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 23 18:53:00 PDT 2019


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

            Bug ID: 42366
           Summary: constexpr pointer to data member conversion issue
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ankur.dedev at tuta.io
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

The code below fails to compile in Clang 8.0.0, the following Stack Overflow
answers https://stackoverflow.com/a/55844722/9363849 suggests that it might not
be the intended behavior.


// Base class.
struct Base {};

// Data class.
struct Data { int foo; };

// Derived class.
struct Derived : Base, Data { int bar; };

// Main function.
int main()
{
  constexpr int Data::* data_p{ &Data::foo };
  constexpr int Derived::* derived_p{ data_p };
  constexpr int Base::* base_p{ static_cast<int Base::*>(derived_p) };

  return (base_p == nullptr);
}

-- 
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/32c548f1/attachment.html>


More information about the llvm-bugs mailing list