[gcc r17-3485] c++: testsuite: fix cpp0x/initlist135.C portability

Patrick Palka via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:2bb0802bf844915658a87595aaa186d2ed787006

commit r17-3485-g2bb0802bf844915658a87595aaa186d2ed787006
Author: Patrick Palka <[email protected]>
Date:   Thu Aug 20 21:42:41 2026 -0400

    c++: testsuite: fix cpp0x/initlist135.C portability
    
    The inline definition of std::initializer_list in this testcase is not
    what the compiler expects on i686 due to over-reduction of the original
    testcase.  Better to just include <initializer_list> instead.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/cpp0x/initlist135.C: Include <initializer_list> and
            remove the inline definition of std::initializer_list.

Diff:
---
 gcc/testsuite/g++.dg/cpp0x/initlist135.C | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist135.C b/gcc/testsuite/g++.dg/cpp0x/initlist135.C
index 759ff6833a2e..8dda882f8d5d 100644
--- a/gcc/testsuite/g++.dg/cpp0x/initlist135.C
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist135.C
@@ -1,14 +1,9 @@
 // PR c++/126472
 // { dg-do run { target c++11 } }
 
+#include <initializer_list>
+
 namespace std {
-template <class _E> struct initializer_list {
-  typedef const _E *const_iterator;
-  const _E *_M_array;
-  unsigned long _M_len;
-  const_iterator begin() const { return _M_array; }
-  const_iterator end() const { return begin() + _M_len; }
-};
 struct _Optional_payload_base {
   struct _Storage {
     constexpr _Storage() : _M_empty() {}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.