[llvm-bugs] [Bug 43732] New: static constexpr member is not a constant expression when read from a reference

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 20 08:16:53 PDT 2019


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

            Bug ID: 43732
           Summary: static constexpr member is not a constant expression
                    when read from a reference
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jonathan.poelen at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

#include <type_traits>

struct A
{
  static constexpr std::true_type value {};
};

int main()
{
  A a;
  A& ref = a;
  auto v = ref.value;
  constexpr bool r1 = a.value; //ok
  constexpr bool r2 = ref.value; // error
  constexpr bool r3 = v; // ok
}

This works with GCC and MSVC
https://godbolt.org/z/NiIz02

-- 
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/20191020/6e017ea3/attachment.html>


More information about the llvm-bugs mailing list