Summary: | Error from simple typedef/void combination | ||
---|---|---|---|
Product: | gcc | Reporter: | Daniel Richard G. <skunk> |
Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | CC: | bangerth, ben, gcc-bugs, giovannibajo, jsm28, lerdsuwa, paul_m_doc, pinskia, skunk, tbm |
Priority: | P3 | ||
Version: | 4.2.0 | ||
Target Milestone: | --- | ||
Host: | i386-unknown-freebsd4.8 | Target: | i386-unknown-freebsd4.8 |
Build: | i386-unknown-freebsd4.8 | Known to work: | |
Known to fail: | Last reconfirmed: |
Description
Daniel Richard G.
2007-06-16 04:38:46 UTC
This is actually invalid C++ which we did not reject before 4.2.0. *** This bug has been marked as a duplicate of 9278 *** (In reply to comment #0) > Came across this head-scratcher in building Qt with GCC 4.2.0. Heavily > simplified version: > > foo.cxx: > typedef void (*funcptr)(void); > > typedef void GLvoid; > typedef GLvoid (*_GLUfuncptr)(GLvoid); > > int foo(void) { return 1; } > > $ g++ -c foo.cxx > foo.cxx:4: error: '<anonymous>' has incomplete type > foo.cxx:4: error: invalid use of 'GLvoid' > > Compiles fine with 4.1.2 and 2.95.4. > You can patch GL/glu.h as e.g. #ifdef __cplusplus typedef void (*_GLUfuncptr)(void); #else typedef GLvoid (*_GLUfuncptr)(GLvoid); #endif I'm assuming that the line that now fails to compile in C++ is still valid C. I'll admit, I don't really see the point to using a typedef for void. Looking at CVS for glu.h, the official patch is: #ifdef __cplusplus typedef GLvoid (*_GLUfuncptr)(); #else ... |