public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17644] New: unexpected symbol redefinition error
@ 2004-09-23 22:23 boris at kolpackov dot net
  2004-09-23 22:50 ` [Bug c++/17644] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: boris at kolpackov dot net @ 2004-09-23 22:23 UTC (permalink / raw)
  To: gcc-bugs

$ cat >text.cxx
struct foo
{
};

struct bar
{
  foo
  foo ();
};

$ g++ --version
g++ (GCC) 3.3.4 (Debian 1:3.3.4-12)

$ g++ -c test.cxx
test.cxx:8: error: declaration of `foo bar::foo()'
test.cxx:2: error: changes meaning of `foo' from `struct foo'

$ g++-3.4 --version
g++-3.4 (GCC) 3.4.2 (Debian 3.4.2-2)

$ g++ -c test.cxx
test.cxx:8: error: declaration of `foo bar::foo()'
test.cxx:2: error: changes meaning of `foo' from `struct foo'

This code compiles fine with both intel c++ 8.1 and current comeau online.

-- 
           Summary: unexpected symbol redefinition error
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: boris at kolpackov dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-linux
  GCC host triplet: i686-linux
GCC target triplet: i686-linux


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


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

* [Bug c++/17644] unexpected symbol redefinition error
  2004-09-23 22:23 [Bug c++/17644] New: unexpected symbol redefinition error boris at kolpackov dot net
@ 2004-09-23 22:50 ` pinskia at gcc dot gnu dot org
  2004-09-24 18:52 ` boris at kolpackov dot net
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-23 22:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-23 22:50 -------
No GCC is correct, foo cannot be redefined in the same class where you use it differently.

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


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


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

* [Bug c++/17644] unexpected symbol redefinition error
  2004-09-23 22:23 [Bug c++/17644] New: unexpected symbol redefinition error boris at kolpackov dot net
  2004-09-23 22:50 ` [Bug c++/17644] " pinskia at gcc dot gnu dot org
@ 2004-09-24 18:52 ` boris at kolpackov dot net
  2004-09-24 18:57 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: boris at kolpackov dot net @ 2004-09-24 18:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From boris at kolpackov dot net  2004-09-24 18:52 -------
And what about this:

class foo
{
};

struct bar
{
  ::foo
  foo ();
};

illegal too?

And this

struct bar
{
  struct foo
  {
  };

  foo
  foo ();
};

should definitely be illegal, right?



-- 


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


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

* [Bug c++/17644] unexpected symbol redefinition error
  2004-09-23 22:23 [Bug c++/17644] New: unexpected symbol redefinition error boris at kolpackov dot net
  2004-09-23 22:50 ` [Bug c++/17644] " pinskia at gcc dot gnu dot org
  2004-09-24 18:52 ` boris at kolpackov dot net
@ 2004-09-24 18:57 ` pinskia at gcc dot gnu dot org
  2004-09-24 19:06 ` boris at kolpackov dot net
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-24 18:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-24 18:57 -------
The first example is valid because ::foo is explicantly named but the second is invalid.  Basically in C++ 
you have to "reparse" the struct again after finishing the struct  and the standard says that if the type is 
different than before it is an error.

-- 


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


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

* [Bug c++/17644] unexpected symbol redefinition error
  2004-09-23 22:23 [Bug c++/17644] New: unexpected symbol redefinition error boris at kolpackov dot net
                   ` (2 preceding siblings ...)
  2004-09-24 18:57 ` pinskia at gcc dot gnu dot org
@ 2004-09-24 19:06 ` boris at kolpackov dot net
  2004-11-06 21:18 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: boris at kolpackov dot net @ 2004-09-24 19:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From boris at kolpackov dot net  2004-09-24 19:06 -------
> the second is invalid

however it is accepted by g++ 3.4.2

> Basically in C++ you have to "reparse" the struct again after finishing
> the struct  and the standard says that if the type is  different than 
> before it is an error.

You mean the type of symbol is different or the type is different? I always
thought that types and functions form separate symbol spaces. If what you are
saying is true then the following is illegal too, right?

struct foo
{
};

foo
foo ();



-- 


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


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

* [Bug c++/17644] unexpected symbol redefinition error
  2004-09-23 22:23 [Bug c++/17644] New: unexpected symbol redefinition error boris at kolpackov dot net
                   ` (3 preceding siblings ...)
  2004-09-24 19:06 ` boris at kolpackov dot net
@ 2004-11-06 21:18 ` pinskia at gcc dot gnu dot org
  2005-07-31  5:41 ` pinskia at gcc dot gnu dot org
  2005-07-31  5:46 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-06 21:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-06 21:18 -------
*** Bug 18320 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |igodard at pacbell dot net


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


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

* [Bug c++/17644] unexpected symbol redefinition error
  2004-09-23 22:23 [Bug c++/17644] New: unexpected symbol redefinition error boris at kolpackov dot net
                   ` (4 preceding siblings ...)
  2004-11-06 21:18 ` pinskia at gcc dot gnu dot org
@ 2005-07-31  5:41 ` pinskia at gcc dot gnu dot org
  2005-07-31  5:46 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-31  5:41 UTC (permalink / raw)
  To: gcc-bugs


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

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


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


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

* [Bug c++/17644] unexpected symbol redefinition error
  2004-09-23 22:23 [Bug c++/17644] New: unexpected symbol redefinition error boris at kolpackov dot net
                   ` (5 preceding siblings ...)
  2005-07-31  5:41 ` pinskia at gcc dot gnu dot org
@ 2005-07-31  5:46 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-31  5:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-31 05:40 -------
Mark 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=17644


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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-23 22:23 [Bug c++/17644] New: unexpected symbol redefinition error boris at kolpackov dot net
2004-09-23 22:50 ` [Bug c++/17644] " pinskia at gcc dot gnu dot org
2004-09-24 18:52 ` boris at kolpackov dot net
2004-09-24 18:57 ` pinskia at gcc dot gnu dot org
2004-09-24 19:06 ` boris at kolpackov dot net
2004-11-06 21:18 ` pinskia at gcc dot gnu dot org
2005-07-31  5:41 ` pinskia at gcc dot gnu dot org
2005-07-31  5:46 ` 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).