1

When I declare a variable of this incomplete type it compiles fine under clang:

int (* a)[]

But when I declare a function parameter of the same type it fails. Any rationale?

void func(int (*)[])

Life example.

It's the same in 'gcc' also.

AnArrayOfFunctions
  • 3,452
  • 2
  • 29
  • 66
  • http://stackoverflow.com/questions/20570857/pointer-to-array-of-unknown-bound – Gabriel Mar 15 '15 at 00:37
  • I never find a good explanation there. They pointed out my first construction as illegal but it actually compiles. Also I'm comparing it's usage as a parameter and a variable declaration while the other one is describing the first case. – AnArrayOfFunctions Mar 15 '15 at 00:42
  • I closed it as a duplicate of a different question. Please comment if you feel the answers there do not answer your question. Note: as pointed out there, although it's currently invalid to use such types as function parameters, it's being made legal and so should compile without issues in a future version of C++. –  Mar 15 '15 at 00:51
  • a successfully compiled program doesn't neccessarily be a legal program – phuclv Mar 15 '15 at 02:51

0 Answers0