This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/32364] Error from simple typedef/void combination
- From: "craig dot powers at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Aug 2007 19:08:03 -0000
- Subject: [Bug c++/32364] Error from simple typedef/void combination
- References: <bug-32364-8784@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from craig dot powers at gmail dot com 2007-08-15 19:08 -------
(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.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32364