Author
anonymous
almost 7 years ago
Language
Compiler
Options
Author
anonymous
almost 7 years ago
$
prog.cc: In function 'int main()':
prog.cc:13:38: error: 'constexpr std::array<int, N> createTable() [with int N = 1]' called in a constant expression
constexpr auto t1 = createTable<1>();
^
prog.cc:4:37: note: 'constexpr std::array<int, N> createTable() [with int N = 1]' is not usable as a 'constexpr' function because:
constexpr static std::array<int, N> createTable() {
^~~~~~~~~~~
prog.cc:7:6: error: call to non-'constexpr' function 'std::array<_Tp, _Nm>::value_type& std::array<_Tp, _Nm>::operator[](std::array<_Tp, _Nm>::size_type) [with _Tp = int; long unsigned int _Nm = 1; std::array<_Tp, _Nm>::reference = int&; std::array<_Tp, _Nm>::value_type = int; std::array<_Tp, _Nm>::size_type = long unsigned int]'
a[i] = i;
~^
prog.cc:14:38: error: 'constexpr std::array<int, N> createTable() [with int N = 1]' called in a constant expression
constexpr auto t2 = createTable<1>();
^
prog.cc:15:23: error: non-constant condition for static assertion
static_assert(t1[0] == t2[0], "can build.");
Exit Code:
1