mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 00:36:16 +02:00
Bug 377838 - Name resolution gets confused by a class and a namespace
with the same name
This commit is contained in:
parent
5ef2d0db02
commit
b6a384b943
2 changed files with 21 additions and 1 deletions
|
@ -4955,6 +4955,23 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
assertEquals(1, tu.getDeclarations().length);
|
assertEquals(1, tu.getDeclarations().length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// namespace A {
|
||||||
|
//
|
||||||
|
// template <typename T>
|
||||||
|
// struct A {
|
||||||
|
// A();
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template <typename U>
|
||||||
|
// A<U>::A() {}
|
||||||
|
//
|
||||||
|
// A<int> a;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
public void testBug377838() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
|
|
||||||
// namespace N {
|
// namespace N {
|
||||||
// inline namespace M {
|
// inline namespace M {
|
||||||
// template<class T> void f(T&) { }
|
// template<class T> void f(T&) { }
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
* Bryan Wilkinson (QNX)
|
* Bryan Wilkinson (QNX)
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
* Jens Elmenthaler - http://bugs.eclipse.org/173458 (camel case completion)
|
* Jens Elmenthaler - http://bugs.eclipse.org/173458 (camel case completion)
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -136,6 +137,8 @@ abstract public class CPPScope implements ICPPASTInternalScope {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
IASTName segmentName = segments[i];
|
IASTName segmentName = segments[i];
|
||||||
|
if ((scopeName instanceof ICPPASTTemplateId) != (segmentName instanceof ICPPASTTemplateId))
|
||||||
|
return false;
|
||||||
if (!CharArrayUtils.equals(scopeName.getSimpleID(), segmentName.getSimpleID()))
|
if (!CharArrayUtils.equals(scopeName.getSimpleID(), segmentName.getSimpleID()))
|
||||||
return false;
|
return false;
|
||||||
scope= scope.getParent();
|
scope= scope.getParent();
|
||||||
|
|
Loading…
Add table
Reference in a new issue