re PR c++/64665 (Overload resolution not working with std::initializer_list<std:...
authorPaolo Carlini <paolo.carlini@oracle.com>
Thu, 5 Mar 2015 09:15:58 +0000 (09:15 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 5 Mar 2015 09:15:58 +0000 (09:15 +0000)
2015-03-05  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/64665
* g++.dg/cpp0x/initlist92.C: New.

From-SVN: r221207

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/initlist92.C [new file with mode: 0644]

index 77da7e936fb5fd0585dc3f16dfb22bff199b9be0..2dff949ae1081ffe2dba4584e46beeeafb90ddee 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-05  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/64665
+       * g++.dg/cpp0x/initlist92.C: New.
+
 2015-03-05  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/65310
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist92.C b/gcc/testsuite/g++.dg/cpp0x/initlist92.C
new file mode 100644 (file)
index 0000000..527533c
--- /dev/null
@@ -0,0 +1,56 @@
+// PR c++/64665, DR 1467 
+// { dg-do run { target c++11 } }
+
+#include <string>
+#include <cassert>
+
+bool Test1(const bool arg) 
+{
+  return true;
+}
+bool Test1(const std::string arg)
+{
+  return false;
+}
+
+bool Test2(const int arg) 
+{
+  return false;
+}
+bool Test2(const std::initializer_list<int> arg)
+{
+  return true;
+}
+
+struct S 
+{ 
+    S(int _a) : a(_a){}
+    int getA() const { return a; }
+private:
+    int a;
+};
+bool Test3(const int arg) 
+{
+  return true;
+}
+bool Test3(const S arg)
+{
+  return false;
+}
+
+bool Test4(const bool arg) 
+{
+  return false;
+}
+bool Test4(const std::initializer_list<std::string> arg)
+{
+  return true;
+}
+
+int main () 
+{
+  assert ( Test1({"false"}) );
+  assert ( Test2({123}) );
+  assert ( Test3({456}) );
+  assert ( Test4({"false"}) );
+}