[llvm-bugs] [Bug 36349] New: constexpr variable must be initialized by a constant expression

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 12 06:34:10 PST 2018


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

            Bug ID: 36349
           Summary: constexpr variable must be initialized by a constant
                    expression
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: weiss at wsoptics.de
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

This is a replication of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78022

The following code used to compile with clang-4, but now with clang-5 shows the
same behavior as it does with GCC:

template<typename T>
struct A
{
        template<typename... Args>
                constexpr A(Args&&...){}
};

struct B : public A<int>
{
        using A<int>::A;
};

// Uncommenting the following line makes this file compile.
//constexpr B p{0};
// Commenting the following line makes this file compile.
template<typename>
struct X
{
        X()
        {
                // The following line is fine.
                const B b0{0};
                // The following line produces an error.
                constexpr B b1{0};
        }
};

Maybe this is a dup of 36333.

-- 
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/20180212/83c04537/attachment.html>


More information about the llvm-bugs mailing list