PR14950: Fix out-of-bounds function parameter access in literal operator lookup.
llvm-svn: 172514
This commit is contained in:
parent
bb78a04088
commit
550de45861
|
@ -2536,7 +2536,7 @@ Sema::LookupLiteralOperator(Scope *S, LookupResult &R,
|
|||
if (FD->getNumParams() == 1 &&
|
||||
FD->getParamDecl(0)->getType()->getAs<PointerType>())
|
||||
IsRaw = true;
|
||||
else {
|
||||
else if (FD->getNumParams() == ArgTys.size()) {
|
||||
IsExactMatch = true;
|
||||
for (unsigned ArgIdx = 0; ArgIdx != ArgTys.size(); ++ArgIdx) {
|
||||
QualType ParamTy = FD->getParamDecl(ArgIdx)->getType();
|
||||
|
|
|
@ -135,3 +135,9 @@ namespace Namespace {
|
|||
int _y(unsigned long long);
|
||||
int k2 = 123_y; // expected-error {{no matching literal operator for call to 'operator "" _y'}}
|
||||
}
|
||||
|
||||
namespace PR14950 {
|
||||
template<...> // expected-error {{expected template parameter}}
|
||||
int operator"" _b(); // expected-error {{no function template matches function template specialization}}
|
||||
int main() { return 0_b; } // expected-error {{no matching literal operator for call to 'operator "" _b'}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue