<p dir="ltr">Test case?</p>
<div class="gmail_quote">On Mar 25, 2016 12:16 AM, "Mehdi Amini via llvm-commits" <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: mehdi_amini<br>
Date: Fri Mar 25 02:11:31 2016<br>
New Revision: 264391<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=264391&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=264391&view=rev</a><br>
Log:<br>
Fix perfect forwarding for StringMap<br>
<br>
From: Mehdi Amini <<a href="mailto:mehdi.amini@apple.com">mehdi.amini@apple.com</a>><br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/ADT/StringMap.h<br>
<br>
Modified: llvm/trunk/include/llvm/ADT/StringMap.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringMap.h?rev=264391&r1=264390&r2=264391&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringMap.h?rev=264391&r1=264390&r2=264391&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/ADT/StringMap.h (original)<br>
+++ llvm/trunk/include/llvm/ADT/StringMap.h Fri Mar 25 02:11:31 2016<br>
@@ -123,9 +123,9 @@ public:<br>
<br>
   explicit StringMapEntry(unsigned strLen)<br>
     : StringMapEntryBase(strLen), second() {}<br>
-  template <class InitTy><br>
-  StringMapEntry(unsigned strLen, InitTy &&V)<br>
-      : StringMapEntryBase(strLen), second(std::forward<InitTy>(V)) {}<br>
+  template <typename... InitTy><br>
+  StringMapEntry(unsigned strLen, InitTy &&... InitVals)<br>
+      : StringMapEntryBase(strLen), second(std::forward<InitTy>(InitVals)...) {}<br>
<br>
   StringRef getKey() const {<br>
     return StringRef(getKeyData(), getKeyLength());<br>
@@ -145,9 +145,9 @@ public:<br>
<br>
   /// Create a StringMapEntry for the specified key construct the value using<br>
   /// \p InitiVals.<br>
-  template <typename AllocatorTy, typename... InitTypes><br>
+  template <typename AllocatorTy, typename... InitTy><br>
   static StringMapEntry *Create(StringRef Key, AllocatorTy &Allocator,<br>
-                                InitTypes &&... InitVals) {<br>
+                                InitTy &&... InitVals) {<br>
     unsigned KeyLength = Key.size();<br>
<br>
     // Allocate a new item with space for the string at the end and a null<br>
@@ -160,8 +160,7 @@ public:<br>
       static_cast<StringMapEntry*>(Allocator.Allocate(AllocSize,Alignment));<br>
<br>
     // Construct the value.<br>
-    new (NewItem)<br>
-        StringMapEntry(KeyLength, std::forward<InitTypes>(InitVals)...);<br>
+    new (NewItem) StringMapEntry(KeyLength, std::forward<InitTy>(InitVals)...);<br>
<br>
     // Copy the string information.<br>
     char *StrBuffer = const_cast<char*>(NewItem->getKeyData());<br>
@@ -172,10 +171,10 @@ public:<br>
   }<br>
<br>
   /// Create - Create a StringMapEntry with normal malloc/free.<br>
-  template<typename InitType><br>
-  static StringMapEntry *Create(StringRef Key, InitType &&InitVal) {<br>
+  template <typename... InitType><br>
+  static StringMapEntry *Create(StringRef Key, InitType &&... InitVal) {<br>
     MallocAllocator A;<br>
-    return Create(Key, A, std::forward<InitType>(InitVal));<br>
+    return Create(Key, A, std::forward<InitType>(InitVal)...);<br>
   }<br>
<br>
   static StringMapEntry *Create(StringRef Key) {<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>