You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#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.
The text was updated successfully, but these errors were encountered:
Ugh, our current constant value representation can't handle this in the case where the initializer_list initialization creates additional unnamed static-storage-duration arrays.
We have a similar problem for nested initializer_list objects outside the constant expression evaluator:
:2:56: error: cannot compile this nested global std::initializer_list yet
std::initializer_list<std::initializer_list> x = {{1,2},{3,4,5}};
^~~~~
Extended Description
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.
The text was updated successfully, but these errors were encountered: