Message ID | 20181201220016.GC21364@redhat.com |
---|---|
State | New |
Headers | show |
Series | [committed] C++ PATCH to add test for c++/83856 | expand |
On Sat, 1 Dec 2018 at 23:01, Marek Polacek <polacek@redhat.com> wrote: > > Tested x86_64-linux, applying to trunk. > > 2018-12-01 Marek Polacek <polacek@redhat.com> > > PR c++/83856 > * g++.dg/cpp1y/lambda-generic-83856.C: New test. > > diff --git gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C > new file mode 100644 > index 00000000000..ab82b6241aa > --- /dev/null > +++ gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C > @@ -0,0 +1,30 @@ > +// PR c++/83856 > +// { dg-do compile { target c++14 } } > + > +namespace std { > +template <typename _Tp> _Tp declval(); > +template <class _E> class initializer_list { > + _E *_M_len; > + > +public: > + unsigned long size; > + _E begin(); > +}; > +template <typename, unsigned> struct array { void operator[](long); }; > +} // namespace std > + > +template <class> struct simd { > + static int size(); > + template <class F> simd(F, decltype(std::declval<F>()(0)) * = nullptr) {} > +}; > +template <class V, class... F> > +void test_tuples(std::initializer_list<std::array<float, 1>> data, > + F... fun_pack) { > + auto it = data.begin(); > + const int remaining = V::size(); > + [](...) {}((fun_pack([&](auto) { it[remaining]; }), 0)...); > +} > + > +void f() { > + test_tuples<simd<float>>({}, [](simd<float>) {}); > +} Hi, This new test fails on arm and other targets according to gcc-testresults. On arm, I can see: /gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C:6:27: fatal error: definition of 'class std::initializer_list<_E>' does not match '#include <initializer_list>' compilation terminated. compiler exited with status 1 FAIL: g++.dg/cpp1y/lambda-generic-83856.C -std=c++14 (test for excess errors) Christophe
On Mon, Dec 03, 2018 at 10:14:11AM +0100, Christophe Lyon wrote: > This new test fails on arm and other targets according to > gcc-testresults. On arm, I can see: > /gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C:6:27: fatal error: > definition of 'class std::initializer_list<_E>' does not match > '#include <initializer_list>' > compilation terminated. > compiler exited with status 1 > FAIL: g++.dg/cpp1y/lambda-generic-83856.C -std=c++14 (test for excess errors) Ah, again. Sorry about that, I'm fixing it with this. 2018-12-03 Marek Polacek <polacek@redhat.com> * g++.dg/cpp1y/lambda-generic-83856.C: Use __SIZE_TYPE__. diff --git gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C index ab82b6241aa..e1f139406ca 100644 --- gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C +++ gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C @@ -7,7 +7,7 @@ template <class _E> class initializer_list { _E *_M_len; public: - unsigned long size; + __SIZE_TYPE__ size; _E begin(); }; template <typename, unsigned> struct array { void operator[](long); };
On Mon, 3 Dec 2018 at 17:05, Marek Polacek <polacek@redhat.com> wrote: > > On Mon, Dec 03, 2018 at 10:14:11AM +0100, Christophe Lyon wrote: > > This new test fails on arm and other targets according to > > gcc-testresults. On arm, I can see: > > /gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C:6:27: fatal error: > > definition of 'class std::initializer_list<_E>' does not match > > '#include <initializer_list>' > > compilation terminated. > > compiler exited with status 1 > > FAIL: g++.dg/cpp1y/lambda-generic-83856.C -std=c++14 (test for excess errors) > > Ah, again. Sorry about that, I'm fixing it with this. > > 2018-12-03 Marek Polacek <polacek@redhat.com> > > * g++.dg/cpp1y/lambda-generic-83856.C: Use __SIZE_TYPE__. Thanks, confirmed it's now OK. > > diff --git gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C > index ab82b6241aa..e1f139406ca 100644 > --- gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C > +++ gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C > @@ -7,7 +7,7 @@ template <class _E> class initializer_list { > _E *_M_len; > > public: > - unsigned long size; > + __SIZE_TYPE__ size; > _E begin(); > }; > template <typename, unsigned> struct array { void operator[](long); };
diff --git gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C new file mode 100644 index 00000000000..ab82b6241aa --- /dev/null +++ gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C @@ -0,0 +1,30 @@ +// PR c++/83856 +// { dg-do compile { target c++14 } } + +namespace std { +template <typename _Tp> _Tp declval(); +template <class _E> class initializer_list { + _E *_M_len; + +public: + unsigned long size; + _E begin(); +}; +template <typename, unsigned> struct array { void operator[](long); }; +} // namespace std + +template <class> struct simd { + static int size(); + template <class F> simd(F, decltype(std::declval<F>()(0)) * = nullptr) {} +}; +template <class V, class... F> +void test_tuples(std::initializer_list<std::array<float, 1>> data, + F... fun_pack) { + auto it = data.begin(); + const int remaining = V::size(); + [](...) {}((fun_pack([&](auto) { it[remaining]; }), 0)...); +} + +void f() { + test_tuples<simd<float>>({}, [](simd<float>) {}); +}