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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

#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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to