]> granicus.if.org Git - clang/commitdiff
Emit conversion functions correctly.
authorAnders Carlsson <andersca@mac.com>
Tue, 25 Aug 2009 13:14:46 +0000 (13:14 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 25 Aug 2009 13:14:46 +0000 (13:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79985 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenModule.cpp
test/CodeGenCXX/conversion-function.cpp [new file with mode: 0644]

index a92e6d9251901fed805d84b910be8d7caeb1747c..24b07ca3f438f4ac1635a71f3e433cd20ede2c16 100644 (file)
@@ -1634,6 +1634,7 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
     return;
   
   switch (D->getKind()) {
+  case Decl::CXXConversion:
   case Decl::CXXMethod:
   case Decl::Function:
     // Skip function templates
diff --git a/test/CodeGenCXX/conversion-function.cpp b/test/CodeGenCXX/conversion-function.cpp
new file mode 100644 (file)
index 0000000..57e5ad7
--- /dev/null
@@ -0,0 +1,9 @@
+// RUN: clang-cc %s -emit-llvm -o %t &&
+struct S {
+       operator int();
+};
+
+// RUN: grep "_ZN1ScviEv" %t
+S::operator int() {
+       return 10;
+}