diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-04-19 21:15:45 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-04-19 21:15:45 +0000 |
commit | ada0888a111750ff4caec49208d11de4e29bfb61 (patch) | |
tree | fd1606ebd8e92b999b11c98cf06d5de110c3169c | |
parent | 8aaa368d0018822734b462ade86797fab2de182f (diff) | |
download | bcm5719-llvm-ada0888a111750ff4caec49208d11de4e29bfb61.tar.gz bcm5719-llvm-ada0888a111750ff4caec49208d11de4e29bfb61.zip |
Fix assertion failure in codegen on non-template deduction guide.
llvm-svn: 300762
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 4 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/cxx1z-class-deduction.cpp | 21 |
2 files changed, 25 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index d84c543deea..19203973ff1 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/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/clang/test/CodeGenCXX/cxx1z-class-deduction.cpp b/clang/test/CodeGenCXX/cxx1z-class-deduction.cpp new file mode 100644 index 00000000000..6f8333b13d6 --- /dev/null +++ b/clang/test/CodeGenCXX/cxx1z-class-deduction.cpp @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -std=c++1z %s -emit-llvm -o - | FileCheck %s + +template<typename T> struct A { + A(T = 0); + A(void*); +}; + +template<typename T> A(T*) -> A<long>; +A() -> A<int>; + +// CHECK-LABEL: @_Z1fPi( +void f(int *p) { + // CHECK: @_ZN1AIiEC + A a{}; + + // CHECK: @_ZN1AIlEC + A b = p; + + // CHECK: @_ZN1AIxEC + A c = 123LL; +} |