Bug 220815 - ambiguous references in c++
ambiguous references in c++
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gcc (Show other bugs)
5.0
All Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-12-27 09:09 EST by Oliver Stabel
Modified: 2007-11-30 17:07 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-12-29 14:41:59 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Oliver Stabel 2006-12-27 09:09:05 EST
Description of problem:
Hi,

it seems this problem is related/similar to an already known one:
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9726>.
Compiling the supplied sample creates an error where the compiler is not able to
properly resolve a symbol.
Note that I am not 100% sure whether this is a bug or an error on my side
(resulting from poor C++ standard knowledge. Comments welcome in this case as well)

Version-Release number of selected component (if applicable):
$ rpm -q gcc
gcc-4.1.1-43.el5
$ uname -a
Linux ls3108v1 2.6.18-1.2747.el5 #1 SMP Thu Nov 9 18:56:16 EST 2006 ia64 ia64
ia64 GNU/Linux

How reproducible:
compile the following with $> c++ -c:
/************/
namespace _STL {

struct __true_type {};
}
using namespace _STL;

struct __true_type { };

namespace std
{
    typedef __true_type __type;
}
/************/

this produces the following output:
test.cpp:11: error: reference to ‘__true_type’ is ambiguous
test.cpp:7: error: candidates are: struct __true_type
test.cpp:3: error:                 struct _STL::__true_type
test.cpp:11: error: reference to ‘__true_type’ is ambiguous
test.cpp:7: error: candidates are: struct __true_type
test.cpp:3: error:                 struct _STL::__true_type
test.cpp:11: error: ‘__true_type’ does not name a type

Steps to Reproduce:
1. c++ -c <sample.cpp>
2.
3.
  
Actual results:

Expected results:


Additional info:
Comment 1 Alexandre Oliva 2006-12-29 14:11:42 EST
Names brought in by a using directive are found by name lookup as if they were
in the nearest namespace enclosing both the using directive and the nominated
namespace.  Thus, both definitions of __true_type are found in the same
namespace, and ambiguity ensues.

Note You need to log in before you can comment on or make changes to this bug.