[SemaCXX11 patch] Patch to prevent a crash when attempting to call a 'deleted' constructor

Richard Smith richard at metafoo.co.uk
Tue Apr 14 03:48:56 PDT 2015


-  switch (CandidateSet.BestViableFunction(S, From->getLocStart(),
Best, true)) {
+  OverloadingResult OVLReasult =
+    CandidateSet.BestViableFunction(S, From->getLocStart(), Best, true);
+  switch (OVLReasult) {

Please move the variable declaration into the switch:

switch (auto Result = CandidateSet.BestViableFunction(...))

Otherwise, LGTM, thanks!

On Mon, Apr 13, 2015 at 3:54 PM, jahanian <fjahanian at apple.com> wrote:

> This patch fixes a crash in release build clang and produces the desired
> diagnostic.
> In the debug build clang it does not crash but produces a misleading
> diagnostic.
>
> Problem is that in TryUserDefinedConversion(…)
> We have:
> case OR_Deleted:
> // ….
> if (CXXConstructorDecl *Constructor
>           =
> dyn_cast<CXXConstructorDecl>(ICS.UserDefined.ConversionFunction)) {
> // …
> }
>
> And ICS.UserDefined.ConversionFunction never gets set for a ‘delete’
> constructor.
>
> Please review.
>
> - Fariborz
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150414/01b7f443/attachment.html>


More information about the cfe-commits mailing list