public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/36709]  New: Compiler allows namespace and class to have same name and doesn't generate ambiguous reference error when it should result from this.
@ 2008-07-03  2:03 rquabili at princeton dot edu
  2008-07-31  7:21 ` [Bug c++/36709] " fang at csl dot cornell dot edu
  2008-07-31  8:40 ` paolo dot carlini at oracle dot com
  0 siblings, 2 replies; 3+ messages in thread
From: rquabili at princeton dot edu @ 2008-07-03  2:03 UTC (permalink / raw)
  To: gcc-bugs

Since J is already defined, the namespace declaration should generate an error
("int J; namespace J{}" does generate an error). G++ gets confused with the g()
call and instead of generating an error it passes the problem to the assembler.

main.cpp:
struct J {
    static void g() {}
};
namespace J {
    void g() {}
}
int main() {
    J::g();
    return 0;
}

Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr
--enable-targets=all --enable-checking=release --build=i486-linux-gnu
--host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)


$ gcc main.cpp
/tmp/ccgibTUW.s: Assembler messages:
/tmp/ccgibTUW.s:25: Error: symbol `_ZN1J1gEs' is already defined


-- 
           Summary: Compiler allows namespace and class to have same name
                    and doesn't generate ambiguous reference error when it
                    should result from this.
           Product: gcc
           Version: 4.2.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rquabili at princeton dot edu


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


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

* [Bug c++/36709] Compiler allows namespace and class to have same name and doesn't generate ambiguous reference error when it should result from this.
  2008-07-03  2:03 [Bug c++/36709] New: Compiler allows namespace and class to have same name and doesn't generate ambiguous reference error when it should result from this rquabili at princeton dot edu
@ 2008-07-31  7:21 ` fang at csl dot cornell dot edu
  2008-07-31  8:40 ` paolo dot carlini at oracle dot com
  1 sibling, 0 replies; 3+ messages in thread
From: fang at csl dot cornell dot edu @ 2008-07-31  7:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fang at csl dot cornell dot edu  2008-07-31 07:19 -------
Dupe of PR 30734 (first reported as PR 2708).


-- 

fang at csl dot cornell dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fang at csl dot cornell dot
                   |                            |edu


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


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

* [Bug c++/36709] Compiler allows namespace and class to have same name and doesn't generate ambiguous reference error when it should result from this.
  2008-07-03  2:03 [Bug c++/36709] New: Compiler allows namespace and class to have same name and doesn't generate ambiguous reference error when it should result from this rquabili at princeton dot edu
  2008-07-31  7:21 ` [Bug c++/36709] " fang at csl dot cornell dot edu
@ 2008-07-31  8:40 ` paolo dot carlini at oracle dot com
  1 sibling, 0 replies; 3+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-07-31  8:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paolo dot carlini at oracle dot com  2008-07-31 08:39 -------


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


-- 

paolo dot carlini at oracle dot com changed:

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


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


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-03  2:03 [Bug c++/36709] New: Compiler allows namespace and class to have same name and doesn't generate ambiguous reference error when it should result from this rquabili at princeton dot edu
2008-07-31  7:21 ` [Bug c++/36709] " fang at csl dot cornell dot edu
2008-07-31  8:40 ` paolo dot carlini at oracle 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).