[llvm-bugs] [Bug 46499] New: static constepxr members of arguments passed by reference are not recognised as constexpr

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 29 05:06:55 PDT 2020


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

            Bug ID: 46499
           Summary: static constepxr members of arguments passed by
                    reference are not recognised as constexpr
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rogero at howzatt.co.uk
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

clang does not appear to recognise that static constexpr members of arguments
passed by reference are constexpr.


template <int N>
struct A
{
        static constexpr int size = N;
};

void foo(A<4> v) // By-value is OK
{
        static_assert(v.size == 4);
}

void bar(A<4> & v) // By-ref is not
{
        static_assert(v.size == 4); // clang error
}


See https://godbolt.org/z/sM2qhZ

-- 
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/20200629/0c6226f8/attachment-0001.html>


More information about the llvm-bugs mailing list