summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp4
-rw-r--r--clang/test/CodeGenCXX/cxx1z-class-deduction.cpp21
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;
+}
OpenPOWER on IntegriCloud