From: Richard Smith Date: Wed, 19 Apr 2017 21:15:45 +0000 (+0000) Subject: Fix assertion failure in codegen on non-template deduction guide. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e6df5fb1026dda5b4c81363c802532b10e5f15c5;p=clang Fix assertion failure in codegen on non-template deduction guide. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300762 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index d84c543dee..19203973ff 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -3794,6 +3794,10 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { AddDeferredUnusedCoverageMapping(D); break; + case Decl::CXXDeductionGuide: + // Function-like, but does not result in code emission. + break; + case Decl::Var: case Decl::Decomposition: // Skip variable templates diff --git a/test/CodeGenCXX/cxx1z-class-deduction.cpp b/test/CodeGenCXX/cxx1z-class-deduction.cpp new file mode 100644 index 0000000000..6f8333b13d --- /dev/null +++ b/test/CodeGenCXX/cxx1z-class-deduction.cpp @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -std=c++1z %s -emit-llvm -o - | FileCheck %s + +template struct A { + A(T = 0); + A(void*); +}; + +template A(T*) -> A; +A() -> A; + +// CHECK-LABEL: @_Z1fPi( +void f(int *p) { + // CHECK: @_ZN1AIiEC + A a{}; + + // CHECK: @_ZN1AIlEC + A b = p; + + // CHECK: @_ZN1AIxEC + A c = 123LL; +}