forked from OSchip/llvm-project
Change assertion to quick exit from checking function.
Remove the assertion that could be triggered by invalid code. Replace it with an early exit from the checking function. llvm-svn: 317073
This commit is contained in:
parent
c51aac675d
commit
7f932dd063
|
@ -2555,9 +2555,8 @@ Sema::CheckDerivedToBaseConversion(QualType Derived, QualType Base,
|
|||
CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true,
|
||||
/*DetectVirtual=*/false);
|
||||
bool DerivationOkay = IsDerivedFrom(Loc, Derived, Base, Paths);
|
||||
assert(DerivationOkay &&
|
||||
"Can only be used with a derived-to-base conversion");
|
||||
(void)DerivationOkay;
|
||||
if (!DerivationOkay)
|
||||
return true;
|
||||
|
||||
const CXXBasePath *Path = nullptr;
|
||||
if (!Paths.isAmbiguous(Context.getCanonicalType(Base).getUnqualifiedType()))
|
||||
|
|
|
@ -37,3 +37,17 @@ struct S : A::B::C {
|
|||
using A::B::C::f; // expected-error {{no member named 'f' in 'A::B::C'}}
|
||||
|
||||
};
|
||||
|
||||
struct S1 {};
|
||||
|
||||
struct S2 : S1 {};
|
||||
|
||||
struct S3 : S2 {
|
||||
void run();
|
||||
};
|
||||
|
||||
struct S4: S3 {};
|
||||
|
||||
void test(S4 *ptr) {
|
||||
ptr->S1::run(); // expected-error {{no member named 'run' in 'S1'}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue