[llvm-bugs] [Bug 24676] New: non-type template argument not detected as constexpr in template variable

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 2 05:16:19 PDT 2015


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

            Bug ID: 24676
           Summary: non-type template argument not detected as constexpr
                    in template variable
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bernarddesmyter at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following program does not compile on clang 3.6.2 :
#include <array>
template<int w> constexpr std::array<int, 1> val{w};

The code is rejected with this error :
a.cpp:4:34: error: constexpr variable 'val' must be initialized by a constant
expression
constexpr std::array<int, 1> val{w};
                                ~^~
1 error generated.


This bug is not present when array is not used :
template<int w> constexpr int{w};
is fine

-- 
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/20150902/7d6bf83c/attachment.html>


More information about the llvm-bugs mailing list