NO

Author Topic: [FIXED] Incomplete types in structures = confusing error message  (Read 2362 times)

iZzz32

  • Guest
Code: [Select]
struct Foo
{
  struct Bar bar;
};
Quote from: pocc -c test.c
test.c(4): error #2132: Size of '(incomplete) struct Foo' exceeds 2147483647 bytes.

With typedefs it is even more confusing (no "incomplete" word).
I meant struct Bar *bar obviously, and as the structure is pretty large it took me a while to understand what's wrong. Maybe a compiler should say something like Undefined size for 'bar' with type '(incomplete) struct Bar'. as it does when I try to define a variable of incomplete type?
« Last Edit: June 22, 2012, 02:23:31 PM by iZzz32 »

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: (Minor bug) Incomplete types in structures = confusing error message
« Reply #1 on: June 03, 2012, 04:56:48 PM »
Hmm... I can't find a decent check for incomplete struct/union member types at all (not even in the original, very old, code). It's in a long complicated function, which has become longer and more complicated with C99 and C11 changes... The error you get is more or less by accident.

Sounds like a rather major bug...
I will have to investigate...
/Pelle