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: unassignedclangb...@nondot.org
          Reporter: ambr...@gmail.com
                CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
                    llvm-bugs@lists.llvm.org, richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to