PR14950: Fix out-of-bounds function parameter access in literal operator lookup.

llvm-svn: 172514
This commit is contained in:
Richard Smith 2013-01-15 07:12:59 +00:00
parent bb78a04088
commit 550de45861
2 changed files with 7 additions and 1 deletions

View File

@ -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();

View File

@ -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'}}
}