Note: this is the follow-up question for this question.
Sample code (t334.cpp):
typedef int T0;
typedef T0 T1[];
typedef T1* T2[];
T1 x1 = { 13 };
T2 x2 = { &x1 };
Invocations:
$ g++ t334.cpp -std=c++11 -pedantic -Wall -Wextra -c
t334.cpp:6:11: warning: conversions to arrays of unknown bound are only available with ‘-std=c++20’ or ‘-std=gnu++20’ [-Wpedantic]
6 | T2 x2 = { &x1 };
| ^~~
$ clang++ t334.cpp -std=c++11 -pedantic -Wall -Wextra -c
t334.cpp:6:11: error: cannot initialize an array element of type 'T1 *' (aka 'T0 (*)[]') with an rvalue of type 'T0 (*)[1]'
T2 x2 = { &x1 };
^~~
Can someone explain, what is wrong with this C++ code?
Note: the equivalent C code is valid, because int (*)[] and int (*)[1] are compatible. Meaning that in C++ they aren't?