forked from OSchip/llvm-project
Make the selection of type declarations in Sema::getTypeName
deterministic when faced with an ambiguity. This eliminates the annoying test/SemaCXX/using-directive.cpp failure. llvm-svn: 68952
This commit is contained in:
parent
092b8b6fdb
commit
712a351c42
|
|
@ -85,8 +85,10 @@ Sema::TypeTy *Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
|
||||||
for (LookupResult::iterator Res = Result.begin(), ResEnd = Result.end();
|
for (LookupResult::iterator Res = Result.begin(), ResEnd = Result.end();
|
||||||
Res != ResEnd; ++Res) {
|
Res != ResEnd; ++Res) {
|
||||||
if (isa<TypeDecl>(*Res) || isa<ObjCInterfaceDecl>(*Res)) {
|
if (isa<TypeDecl>(*Res) || isa<ObjCInterfaceDecl>(*Res)) {
|
||||||
IIDecl = *Res;
|
if (!IIDecl ||
|
||||||
break;
|
(*Res)->getLocation().getRawEncoding() <
|
||||||
|
IIDecl->getLocation().getRawEncoding())
|
||||||
|
IIDecl = *Res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
// RUN: clang-cc -fsyntax-only -verify %s
|
// RUN: clang-cc -fsyntax-only -verify %s
|
||||||
// XFAIL
|
|
||||||
|
|
||||||
namespace A {
|
namespace A {
|
||||||
short i; // expected-note 2{{candidate found by name lookup is 'A::i'}}
|
short i; // expected-note 2{{candidate found by name lookup is 'A::i'}}
|
||||||
|
|
@ -95,8 +94,7 @@ namespace OneFunction {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace TwoTag {
|
namespace TwoTag {
|
||||||
struct X; // expected-note{{candidate found by name lookup is 'TwoTag::X'}} \
|
struct X; // expected-note{{candidate found by name lookup is 'TwoTag::X'}}
|
||||||
// expected-note{{forward declaration}}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace FuncHidesTagAmbiguity {
|
namespace FuncHidesTagAmbiguity {
|
||||||
|
|
@ -105,7 +103,6 @@ namespace FuncHidesTagAmbiguity {
|
||||||
using namespace TwoTag;
|
using namespace TwoTag;
|
||||||
|
|
||||||
void test() {
|
void test() {
|
||||||
(void)X(); // expected-error{{reference to 'X' is ambiguous}} \
|
(void)X(); // expected-error{{reference to 'X' is ambiguous}}
|
||||||
// FIXME: expected-error{{invalid use of incomplete type}}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue