[llvm-bugs] [Bug 32336] New: constexpr ignored in out-of-class definition of static member

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Mar 18 03:46:38 PDT 2017


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

            Bug ID: 32336
           Summary: constexpr ignored in out-of-class definition of static
                    member
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david_work at me.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Clang rejects this case:

struct c { int v; };

template< typename t >
struct s {
    static c const i;
};
template< typename t >
constexpr c s< t >::i = { 5 };

static_assert ( s< int >::i.v == 5, "" );

It seems that "constexpr" is treated as "const" in an out-of-class static data
member definition.

(GCC accepts it.)

-- 
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/20170318/6c7750e2/attachment.html>


More information about the llvm-bugs mailing list