[LLVMbugs] [Bug 15117] New: Unable to use std::initializer_list in constant expressions

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 30 00:09:36 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15117

             Bug #: 15117
           Summary: Unable to use std::initializer_list in constant
                    expressions
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dgregor at apple.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following is well-formed:


#include <initializer_list>
constexpr auto foo{1, 2};


but Clang rejects it with


t2.cpp:3:16: error: constexpr variable 'foo' must be initialized by a constant
      expression
constexpr auto foo{1, 2};
               ^  ~~~~~~

because RecordExprEvaluator::VisitInitListExpr doesn't handle
std::initializer_lists. What it should do is create an array and then set the
pointer/length fields of the std::initializer_list to point into that array.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list