From 512141f41a344cd2b0f317e013e286e412077bf1 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Thu, 5 Mar 2015 09:15:58 +0000 Subject: [PATCH] re PR c++/64665 (Overload resolution not working with std::initializer_list and bool) 2015-03-05 Paolo Carlini PR c++/64665 * g++.dg/cpp0x/initlist92.C: New. From-SVN: r221207 --- gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/g++.dg/cpp0x/initlist92.C | 56 +++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist92.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 77da7e936fb..2dff949ae10 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-03-05 Paolo Carlini + + PR c++/64665 + * g++.dg/cpp0x/initlist92.C: New. + 2015-03-05 Richard Biener 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 index 00000000000..527533cf961 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist92.C @@ -0,0 +1,56 @@ +// PR c++/64665, DR 1467 +// { dg-do run { target c++11 } } + +#include +#include + +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 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 arg) +{ + return true; +} + +int main () +{ + assert ( Test1({"false"}) ); + assert ( Test2({123}) ); + assert ( Test3({456}) ); + assert ( Test4({"false"}) ); +} -- 2.30.2