public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/35138]  New: g++ rejects valid code
@ 2008-02-08 13:30 tim at klingt dot org
  2008-02-08 14:01 ` [Bug c++/35138] " tim at klingt dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: tim at klingt dot org @ 2008-02-08 13:30 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 917 bytes --]

g++-4.3 rejects the following code:

namespace n1 {
struct foo{};
}

namespace n2 {
struct foo{};
}

using namespace n1;
using namespace n2;

template <typename tp>
int run(tp const & t) {
    return t.foo;
}

struct bar {
    int foo;
};

int main() {
    bar b;

    run(b);
}

the error message is:
bug.cpp: In function ‘int run(const tp&)’:
bug.cpp:14: error: reference to ‘foo’ is ambiguous
bug.cpp:6: error: candidates are: struct n2::foo
bug.cpp:2: error:                 struct n1::foo

g++-4.1 and g++-4.2 accept the code, though ...


-- 
           Summary: g++ rejects valid code
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tim at klingt dot org


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


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

end of thread, other threads:[~2008-02-13 22:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-08 13:30 [Bug c++/35138] New: g++ rejects valid code tim at klingt dot org
2008-02-08 14:01 ` [Bug c++/35138] " tim at klingt dot org
2008-02-08 16:11 ` [Bug c++/35138] [4.3 Regression] " rguenth at gcc dot gnu dot org
2008-02-08 17:59 ` jakub at gcc dot gnu dot org
2008-02-08 21:52 ` bangerth at dealii dot org
2008-02-08 22:16 ` rguenth at gcc dot gnu dot org
2008-02-11 23:12 ` jakub at gcc dot gnu dot org
2008-02-12 20:15 ` jakub at gcc dot gnu dot org
2008-02-13 22:32 ` jakub at gcc dot gnu dot org
2008-02-13 22:33 ` jakub 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).