[llvm-branch-commits] [cfe-branch] r228789 - Merging r228785:
Hans Wennborg
hans at hanshq.net
Tue Feb 10 18:21:00 PST 2015
Author: hans
Date: Tue Feb 10 20:20:59 2015
New Revision: 228789
URL: http://llvm.org/viewvc/llvm-project?rev=228789&view=rev
Log:
Merging r228785:
------------------------------------------------------------------------
r228785 | rsmith | 2015-02-10 17:48:47 -0800 (Tue, 10 Feb 2015) | 2 lines
PR21857: weaken an incorrect assertion.
------------------------------------------------------------------------
Modified:
cfe/branches/release_36/ (props changed)
cfe/branches/release_36/lib/Sema/SemaLookup.cpp
cfe/branches/release_36/test/SemaCXX/lambda-expressions.cpp
Propchange: cfe/branches/release_36/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 10 20:20:59 2015
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:226008,226049,226136,226282,226382,226384,226624,226707,226754,226863,226877,227062,227088,227220,227251,227278,227295,227368,227393,227861,227979,228053,228464
+/cfe/trunk:226008,226049,226136,226282,226382,226384,226624,226707,226754,226863,226877,227062,227088,227220,227251,227278,227295,227368,227393,227861,227979,228053,228464,228785
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_36/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_36/lib/Sema/SemaLookup.cpp?rev=228789&r1=228788&r2=228789&view=diff
==============================================================================
--- cfe/branches/release_36/lib/Sema/SemaLookup.cpp (original)
+++ cfe/branches/release_36/lib/Sema/SemaLookup.cpp Tue Feb 10 20:20:59 2015
@@ -2500,8 +2500,18 @@ Sema::SpecialMemberOverloadResult *Sema:
// will always be a (possibly implicit) declaration to shadow any others.
OverloadCandidateSet OCS(RD->getLocation(), OverloadCandidateSet::CSK_Normal);
DeclContext::lookup_result R = RD->lookup(Name);
- assert(!R.empty() &&
- "lookup for a constructor or assignment operator was empty");
+
+ if (R.empty()) {
+ // We might have no default constructor because we have a lambda's closure
+ // type, rather than because there's some other declared constructor.
+ // Every class has a copy/move constructor, copy/move assignment, and
+ // destructor.
+ assert(SM == CXXDefaultConstructor &&
+ "lookup for a constructor or assignment operator was empty");
+ Result->setMethod(nullptr);
+ Result->setKind(SpecialMemberOverloadResult::NoMemberOrDeleted);
+ return Result;
+ }
// Copy the candidates as our processing of them may load new declarations
// from an external source and invalidate lookup_result.
Modified: cfe/branches/release_36/test/SemaCXX/lambda-expressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_36/test/SemaCXX/lambda-expressions.cpp?rev=228789&r1=228788&r2=228789&view=diff
==============================================================================
--- cfe/branches/release_36/test/SemaCXX/lambda-expressions.cpp (original)
+++ cfe/branches/release_36/test/SemaCXX/lambda-expressions.cpp Tue Feb 10 20:20:59 2015
@@ -437,3 +437,12 @@ namespace error_in_transform_prototype {
f(S()); // expected-note {{requested here}}
}
}
+
+namespace PR21857 {
+ template<typename Fn> struct fun : Fn {
+ fun() = default;
+ using Fn::operator();
+ };
+ template<typename Fn> fun<Fn> wrap(Fn fn);
+ auto x = wrap([](){});
+}
More information about the llvm-branch-commits
mailing list