[llvm-bugs] [Bug 40195] New: Compile error related to constexpr variable template in a template class

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 1 06:01:12 PST 2019


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

            Bug ID: 40195
           Summary: Compile error related to constexpr variable template
                    in a template class
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++'17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ambrop7 at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

The following C++17 program does not compile:

template<typename>
struct A {
    template<typename>
    inline static constexpr int X = 1;
    inline static constexpr int Y = X<void>;
};
constexpr int Y = A<void>::Y;

clang++ -std=c++17 main.cpp
main.cpp:7:19: error: constexpr variable 'Y' must be initialized by a constant
expression
constexpr int Y = A<void>::Y;
                  ^~~~~~~~~~
1 error generated.

This error is produced with any Clang version starting with 5.0.0 (where
sufficient C++17 support appeared). It compiles with GCC (7.1 and newer).

-- 
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/20190101/aedbff53/attachment.html>


More information about the llvm-bugs mailing list