forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Clang] Fix member lookup so that we don't ignore ambiguous lookups i…
…n some cases There are some cases during member lookup we are aggressively suppressing diagnostics when we should just be suppressing access control diagnostic. In this PR I add the ability to simply suppress access diagnostics while not suppressing ambiguous lookup diagnostics. Fixes: llvm#22413 llvm#29942 llvm#35574 llvm#27224 Differential Revision: https://reviews.llvm.org/D155387
- Loading branch information
Showing
7 changed files
with
113 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
clang/test/CXX/class.derived/class.member.lookup/gh22413.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -verify %s | ||
|
||
struct A { | ||
void operator()(int); // expected-note {{member found by ambiguous name lookup}} | ||
void f(int); // expected-note {{member found by ambiguous name lookup}} | ||
}; | ||
struct B { | ||
void operator()(); // expected-note {{member found by ambiguous name lookup}} | ||
void f() {} // expected-note {{member found by ambiguous name lookup}} | ||
}; | ||
|
||
struct C : A, B {}; | ||
|
||
int f() { | ||
C c; | ||
c(); // expected-error {{member 'operator()' found in multiple base classes of different types}} | ||
c.f(10); //expected-error {{member 'f' found in multiple base classes of different types}} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -verify %s | ||
|
||
struct B1 { | ||
void f(); | ||
static void f(int); | ||
int i; // expected-note 2{{member found by ambiguous name lookup}} | ||
}; | ||
struct B2 { | ||
void f(double); | ||
}; | ||
struct I1: B1 { }; | ||
struct I2: B1 { }; | ||
|
||
struct D: I1, I2, B2 { | ||
using B1::f; | ||
using B2::f; | ||
void g() { | ||
f(); // expected-error {{ambiguous conversion from derived class 'D' to base class 'B1'}} | ||
f(0); // ok | ||
f(0.0); // ok | ||
// FIXME next line should be well-formed | ||
int B1::* mpB1 = &D::i; // expected-error {{non-static member 'i' found in multiple base-class subobjects of type 'B1'}} | ||
int D::* mpD = &D::i; // expected-error {{non-static member 'i' found in multiple base-class subobjects of type 'B1'}} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters