Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326778

Summary: Questionable ambiguity if both using declaration and using directive is used
Product: [Tools] CDT Reporter: Jens Elmenthaler <jens.elmenthaler>
Component: cdt-parserAssignee: Project Inbox <cdt-parser-inbox>
Status: RESOLVED FIXED QA Contact: Mike Kucera <mikekucera>
Severity: normal    
Priority: P3    
Version: 7.0   
Target Milestone: 7.0.2   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
testcase + fix mschorn.eclipse: iplog-

Description Jens Elmenthaler CLA 2010-10-01 09:36:45 EDT
Build Identifier: HEAD

Create a C/C++ project containing the following two files:

// sabel.hpp
#include <iostream>
using std::cout;

// sabel.cpp
#include "sabel.hpp"
using namespace ::std;

void sabel()
{
  cout << "test";
}

"cout" will be reported as a name resolution problem that looks like an ambiguity. If I remove the using directive in the source file or the using declaration in the header file, the indexer doesn't complain. Additionally, if I move the using declaration into the source file, the indexer does not complain either.

Reproducible: Always
Comment 1 Markus Schorn CLA 2010-10-04 03:33:31 EDT
Thanks, I'll have a look at this.
Comment 2 Markus Schorn CLA 2010-10-06 10:05:51 EDT
Created attachment 180332 [details]
testcase + fix
Comment 3 Markus Schorn CLA 2010-10-06 10:07:02 EDT
Fixed in 7.0.2 and 8.0 > 20101006.
Comment 6 Jens Elmenthaler CLA 2010-10-07 03:17:43 EDT
(In reply to comment #3)
> Fixed in 7.0.2 and 8.0 > 20101006.
Hey, you cut the percentage of unresolved names in half for my workspace!! This example was extracted from usages of the ACE libraries, so I'm possible not alone.

Anyway, with the name resolution problem now being shown in the problems view, I expect that the indexer will climb a compiler-like level of correctness with Indigo.

Thanks again for this fix.