When performing template argument deduction for an initializer list,
be sure to perform the argument type adjustments in
[temp.deduct.call]p2, e.g., array decay.

And, when performing these deductions in the context of 'auto', make
sure that we're deducing the P' in std::initializer_list<P'> rather
than the whole initializer list.

Together, this makes code like

  for( auto s : {"Deferred", "New", "Open", "Review"}) { }

work properly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153998 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp b/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
index 0e0e8f2..3437849 100644
--- a/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
+++ b/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
@@ -150,3 +150,19 @@
     g({il, {2, 3}});
   }
 }
+
+namespace Decay {
+  template<typename T>
+  void f(std::initializer_list<T>) {
+    T x = 1; // expected-error{{cannot initialize a variable of type 'const char *' with an rvalue of type 'int'}}
+  }
+
+  void g() {
+    f({"A", "BB", "CCC"}); // expected-note{{in instantiation of function template specialization 'Decay::f<const char *>' requested here}}
+
+    auto x = { "A", "BB", "CCC" };
+    std::initializer_list<const char *> *il = &x;
+
+    for( auto s : {"A", "BB", "CCC", "DDD"}) { }
+  }
+}