public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17605] New: Using types as names in classes not always allowed
@ 2004-09-22 11:00 gcc-bugzilla at gcc dot gnu dot org
  2004-09-22 12:16 ` [Bug c++/17605] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-09-22 11:00 UTC (permalink / raw)
  To: gcc-bugs


When using the following code g++ rejects it:

typedef struct _noget {
  int k;
} Noget;

typedef struct _andet {
  Noget * Noget;
} Andet;

pc-32-84:~/Documents/projects/test djn$ g++ test.c -save-temps
In file included from test.c:1:
test.h:10: error: declaration of `Noget*_andet::Noget'
test.h:7: error: changes meaning of `Noget' from `typedef struct
_noget Noget'
pc-32-84:~/Documents/projects/test djn$ 


And it is perfectly legal C code.

BEGIN test.ii
# 1 "test.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.c"
# 1 "test.h" 1



typedef struct _noget {
  int k;
} Noget;


typedef struct _andet {
  Noget * Noget;
} Andet;
# 2 "test.c" 2

int main(int argc, char **argv) {

  Noget n;
  Andet a;

  return 0;
}
END test.ii

Environment:
System: Linux ec06 2.4.20-31.9 #1 Tue Apr 13 18:04:23 EDT 2004 i686 i686 i386 GNU/Linux
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --prefix=/usr/local

How-To-Repeat:
Compiling the following code:

class Foo {
 public:
  int a;
};

class Bar {
 public:
  Foo * Foo;
};

will also be rejected by g++

-- 
           Summary: Using types as names in classes not always allowed
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: djn at daimi dot au dot dk
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/17605] Using types as names in classes not always allowed
  2004-09-22 11:00 [Bug c++/17605] New: Using types as names in classes not always allowed gcc-bugzilla at gcc dot gnu dot org
@ 2004-09-22 12:16 ` pinskia at gcc dot gnu dot org
  2005-07-31  5:42 ` pinskia at gcc dot gnu dot org
  2005-07-31  5:42 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-22 12:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-22 12:16 -------
This is invalid C++, even though it is valid C.
Basically the error message is correct as you cannot change the meaning of a type which you use during 
the class in the same class.

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


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


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

* [Bug c++/17605] Using types as names in classes not always allowed
  2004-09-22 11:00 [Bug c++/17605] New: Using types as names in classes not always allowed gcc-bugzilla at gcc dot gnu dot org
  2004-09-22 12:16 ` [Bug c++/17605] " pinskia at gcc dot gnu dot org
  2005-07-31  5:42 ` pinskia at gcc dot gnu dot org
@ 2005-07-31  5:42 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-31  5:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-31 05:41 -------
Reopening to ...

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


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


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

* [Bug c++/17605] Using types as names in classes not always allowed
  2004-09-22 11:00 [Bug c++/17605] New: Using types as names in classes not always allowed gcc-bugzilla at gcc dot gnu dot org
  2004-09-22 12:16 ` [Bug c++/17605] " pinskia at gcc dot gnu dot org
@ 2005-07-31  5:42 ` pinskia at gcc dot gnu dot org
  2005-07-31  5:42 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-31  5:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-31 05:41 -------
As a dup of bug 17353.

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

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


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


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

end of thread, other threads:[~2005-07-31  5:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-22 11:00 [Bug c++/17605] New: Using types as names in classes not always allowed gcc-bugzilla at gcc dot gnu dot org
2004-09-22 12:16 ` [Bug c++/17605] " pinskia at gcc dot gnu dot org
2005-07-31  5:42 ` pinskia at gcc dot gnu dot org
2005-07-31  5:42 ` pinskia at gcc dot gnu dot org

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