public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/32364]  New: Error from simple typedef/void combination
@ 2007-06-16  4:38 skunk at iskunk dot org
  2007-06-16  4:53 ` [Bug c++/32364] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: skunk at iskunk dot org @ 2007-06-16  4:38 UTC (permalink / raw)
  To: gcc-bugs

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.


-- 
           Summary: Error from simple typedef/void combination
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: skunk at iskunk dot org
 GCC build triplet: i386-unknown-freebsd4.8
  GCC host triplet: i386-unknown-freebsd4.8
GCC target triplet: i386-unknown-freebsd4.8


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32364


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/32364] Error from simple typedef/void combination
  2007-06-16  4:38 [Bug c++/32364] New: Error from simple typedef/void combination skunk at iskunk dot org
@ 2007-06-16  4:53 ` pinskia at gcc dot gnu dot org
  2007-08-15 19:08 ` craig dot powers at gmail dot com
  2007-08-15 19:13 ` craig dot powers at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-06-16  4:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-06-16 04:53 -------
This is actually invalid C++ which we did not reject before 4.2.0.

*** This bug has been marked as a duplicate of 9278 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32364


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/32364] Error from simple typedef/void combination
  2007-06-16  4:38 [Bug c++/32364] New: Error from simple typedef/void combination skunk at iskunk dot org
  2007-06-16  4:53 ` [Bug c++/32364] " pinskia at gcc dot gnu dot org
@ 2007-08-15 19:08 ` craig dot powers at gmail dot com
  2007-08-15 19:13 ` craig dot powers at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: craig dot powers at gmail dot com @ 2007-08-15 19:08 UTC (permalink / raw)
  To: gcc-bugs



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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/32364] Error from simple typedef/void combination
  2007-06-16  4:38 [Bug c++/32364] New: Error from simple typedef/void combination skunk at iskunk dot org
  2007-06-16  4:53 ` [Bug c++/32364] " pinskia at gcc dot gnu dot org
  2007-08-15 19:08 ` craig dot powers at gmail dot com
@ 2007-08-15 19:13 ` craig dot powers at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: craig dot powers at gmail dot com @ 2007-08-15 19:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from craig dot powers at gmail dot com  2007-08-15 19:13 -------
Looking at CVS for glu.h, the official patch is:
#ifdef __cplusplus
typedef GLvoid (*_GLUfuncptr)();
#else

...


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32364


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-08-15 19:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-16  4:38 [Bug c++/32364] New: Error from simple typedef/void combination skunk at iskunk dot org
2007-06-16  4:53 ` [Bug c++/32364] " pinskia at gcc dot gnu dot org
2007-08-15 19:08 ` craig dot powers at gmail dot com
2007-08-15 19:13 ` craig dot powers at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).