This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/32364] Error from simple typedef/void combination



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]