This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33975] [4.1/4.2/4.3 Regression] Incomplete types may be derefenced
- From: "janis at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Nov 2007 18:01:53 -0000
- Subject: [Bug c++/33975] [4.1/4.2/4.3 Regression] Incomplete types may be derefenced
- References: <bug-33975-10252@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from janis at gcc dot gnu dot org 2007-11-12 18:01 -------
Mainline now reports an error for this code:
elm3b187% /opt/gcc-nightly/trunk/bin/g++ 33975.cc
33975.cc: In function ?int main()?:
33975.cc:8: error: invalid use of incomplete type ?struct S?
33975.cc:1: error: forward declaration of ?struct S?
33975.cc:8: error: initializing argument 1 of ?int f(S)?
The patch that fixed this for mainline:
http://gcc.gnu.org/viewcvs?view=rev&rev=129968
r129968 | jakub | 2007-11-07 19:27:27 +0000 (Wed, 07 Nov 2007)
Here's the source file I used:
struct S;
int f(S s);
int
main ()
{
S *p;
int i = f(*p);
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33975