[llvm-bugs] [Bug 31211] New: Access to static data member array initialized with template parameter is not a constant expression

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 29 11:32:55 PST 2016


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

            Bug ID: 31211
           Summary: Access to static data member array initialized with
                    template parameter is not a constant expression
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: r.hl at gmx.net
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

template <char C>
struct A {
    static constexpr char arr[] = {C};
    static constexpr auto c = *arr;
};

int main() {constexpr auto x = A<' '>::c;}

---

Fails, while it obviously shouldn't--the l-t-r conversion is fine as per
[expr.const]/(2.7.3), since we access a subobject of an object declared with
constexpr.

-- 
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/20161129/98ddc962/attachment-0001.html>


More information about the llvm-bugs mailing list