[cfe-commits] r172514 - in /cfe/trunk: lib/Sema/SemaLookup.cpp test/SemaCXX/cxx11-user-defined-literals.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Mon Jan 14 23:12:59 PST 2013
Author: rsmith
Date: Tue Jan 15 01:12:59 2013
New Revision: 172514
URL: http://llvm.org/viewvc/llvm-project?rev=172514&view=rev
Log:
PR14950: Fix out-of-bounds function parameter access in literal operator lookup.
Modified:
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/test/SemaCXX/cxx11-user-defined-literals.cpp
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=172514&r1=172513&r2=172514&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Tue Jan 15 01:12:59 2013
@@ -2536,7 +2536,7 @@
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();
Modified: cfe/trunk/test/SemaCXX/cxx11-user-defined-literals.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx11-user-defined-literals.cpp?rev=172514&r1=172513&r2=172514&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx11-user-defined-literals.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx11-user-defined-literals.cpp Tue Jan 15 01:12:59 2013
@@ -135,3 +135,9 @@
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'}}
+}
More information about the cfe-commits
mailing list