https://bugs.llvm.org/show_bug.cgi?id=51171

            Bug ID: 51171
           Summary: SIGSEGV at  DeduceTemplateArgumentsByTypeMatch
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: ivan.muras...@gmail.com
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@metafoo.co.uk

Created attachment 25049
  --> https://bugs.llvm.org/attachment.cgi?id=25049&action=edit
The crash reproducer

There is a SIGSEGV (NULL dereference) at DeduceTemplateArgumentsByTypeMatch as
soon as FunctionType parameter passed into the function is NULL. See reproducer
at the attachment

The possible fix for the problem is

--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -4346,7 +4346,7 @@ Sema::TemplateDeductionResult
Sema::DeduceTemplateArguments(
     HasDeducedReturnType = true;
   }

-  if (!ArgFunctionType.isNull()) {
+  if (!ArgFunctionType.isNull() && !FunctionType.isNull()) {
     unsigned TDF =
         TDF_TopLevelParameterTypeList | TDF_AllowCompatibleFunctionType;
     // Deduce template arguments from the function type.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to