]> granicus.if.org Git - clang/commitdiff
Mangling of undeduced 'auto' types, as specified by Itanium C++ ABI.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 21 Feb 2011 20:10:02 +0000 (20:10 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 21 Feb 2011 20:10:02 +0000 (20:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126140 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ItaniumMangle.cpp
test/CodeGenCXX/mangle-exprs.cpp

index d66c374cbec098eff0b23898de13a2c0064bf8b8..e2dbb839838e01a4b1b51a02afc0935fa9e80946 100644 (file)
@@ -1647,8 +1647,11 @@ void CXXNameMangler::mangleType(const DecltypeType *T) {
 
 void CXXNameMangler::mangleType(const AutoType *T) {
   QualType D = T->getDeducedType();
-  assert(!D.isNull() && "can't mangle undeduced auto type");
-  mangleType(D);
+  // <builtin-type> ::= Da  # dependent auto
+  if (D.isNull())
+    Out << "Da";
+  else
+    mangleType(D);
 }
 
 void CXXNameMangler::mangleIntegerLiteral(QualType T,
index 7322171856dc13dafa8a61ba952d9084dcb9adcd..e5f26e584b064c8e2f52a3f393b1a5e891930b00 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+// RUN: %clang_cc1 -std=c++0x -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
 
 template < bool condition, typename T = void >
 struct enable_if { typedef T type; };
@@ -24,6 +24,10 @@ namespace Casts {
   void static_(typename enable_if< O <= static_cast<unsigned>(4) >::type* = 0) {
   }
 
+  template< typename T >
+  void auto_(decltype(new auto(T()))) {
+  }
+
   // FIXME: Test const_cast, reinterpret_cast, dynamic_cast, which are
   // a bit harder to use in template arguments.
   template <unsigned N> struct T {};
@@ -41,4 +45,7 @@ namespace Casts {
 
   // CHECK: define weak_odr void @_ZN5Casts1fILi6EEENS_1TIXT_EEEv
   template T<6> f<6>();
+
+  // CHECK: define weak_odr void @_ZN5Casts5auto_IiEEvDTnw_DapicvT__EEE(
+  template void auto_<int>(int*);
 }