Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

over 6 years ago

Language

C++

Compiler

gcc HEAD 9.0.0 20180818 (experimental)

Options
Warnings
Boost 1.68.0
C++2a(GNU)
no pedantic

Author

anonymous

over 6 years ago

$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.68.0/gcc-head/include -std=gnu++2a
prog.cc: In function 'int main()':
prog.cc:9:62: error: array size in new-expression must be constant
9 |   char (*str2)[some_const2] = new char[some_var2][some_const2];
  |                                                              ^
prog.cc:9:62: error: the value of 'some_const2' is not usable in a constant expression
prog.cc:6:13: note: 'some_const2' was not initialized with a constant expression
6 |   const int some_const2 = some_var2;
  |             ^~~~~~~~~~~
prog.cc:8:10: warning: unused variable 'str1' [-Wunused-variable]
8 |   char (*str1)[some_const1] = new char[some_var1][some_const1];
  |          ^~~~
prog.cc:9:10: warning: unused variable 'str2' [-Wunused-variable]
9 |   char (*str2)[some_const2] = new char[some_var2][some_const2];
  |          ^~~~
Exit Code:
1