Standard C++ library (StandardCplusplus.h) does not work with PIO

Hi,
I just downloaded StandardCplusplus by maniacbug in the platformIO Home libraries tab to use with Arduino. When I try to include StandardCplusplus.h in my programs, I get this error message:
error: default argument for template parameter for class enclosing 'class std::basic_ostream<charT, traits>::sentry'
I have read it might be an incompatible Arduino version (like here StandardCplusplus Library doesn't work with version 1.8 - Installation & Troubleshooting - Arduino Forum). Is it the case with PIO? what am I supposed to do? Wait for a new version of PIO to fix the bug or I can do something?

Here is the full error message:

In file included from C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572/istream:24:0,
             from C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572/complex:20,
             from C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572\complex.cpp:19:
C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572/ostream:318:50: error: default argument for template parameter for class enclosing 'class std::basic_ostream<charT, traits>::sentry'
   class _UCXXEXPORT basic_ostream<charT,traits>::sentry
                                                  ^
In file included from C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572/complex:20:0,
                 from C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572\complex.cpp:19:
C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572/istream:343:107: error: default argument for template parameter for class enclosing 'class std::basic_istream<charT, traits>::sentry'
  template <class charT,class traits = char_traits<charT> > class _UCXXEXPORT basic_istream<charT,traits>::sentry {
                                                                                                           ^
Compiling .pio\build\ATmega328P\lib219\StandardCplusplus_ID572\iostream.cpp.o
*** [.pio\build\ATmega328P\lib219\StandardCplusplus_ID572\complex.cpp.o] Error 1
In file included from C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572/istream:24:0,
                 from C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572/iostream:27,
                 from C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572\iostream.cpp:22:
C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572/ostream:318:50: error: default argument for template parameter for class enclosing 'class std::basic_ostream<charT, traits>::sentry'
   class _UCXXEXPORT basic_ostream<charT,traits>::sentry
                                                  ^
In file included from C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572/iostream:27:0,
                 from C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572\iostream.cpp:22:
C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572/istream:343:107: error: default argument for template parameter for class enclosing 'class std::basic_istream<charT, traits>::sentry'
  template <class charT,class traits = char_traits<charT> > class _UCXXEXPORT basic_istream<charT,traits>::sentry {
                                                                                                           ^
In file included from C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572\ios.cpp:23:0:
C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572/ostream:318:50: error: default argument for template parameter for class enclosing 'class std::basic_ostream<charT, traits>::sentry'
   class _UCXXEXPORT basic_ostream<charT,traits>::sentry
                                                  ^
In file included from C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572\ios.cpp:24:0:
C:\Users\Jean-Christophe\.platformio\lib\StandardCplusplus_ID572/istream:343:107: error: default argument for template parameter for class enclosing 'class std::basic_istream<charT, traits>::sentry'
  template <class charT,class traits = char_traits<charT> > class _UCXXEXPORT basic_istream<charT,traits>::sentry {
                                                                                                           ^
*** [.pio\build\ATmega328P\lib219\StandardCplusplus_ID572\iostream.cpp.o] Error 1
*** [.pio\build\ATmega328P\lib219\StandardCplusplus_ID572\ios.cpp.o] Error 1
====================================================================== [FAILED] Took 2.65 seconds ======================================================================

You can fix this doing the following edits to remove the duplicated default template argument (removal of = char_traits<charT> )

File: istream
Line: 343
Before: template <class charT,class traits = char_traits<charT> > class _UCXXEXPORT basic_istream<charT,traits>::sentry {

After: template <class charT,class traits > class _UCXXEXPORT basic_istream<charT,traits>::sentry {

File: ostream
Line: 317
Before: template <class charT,class traits = char_traits<charT> >
After: template <class charT,class traits>

and anywhere else that the unnecessary default template argument value is given

Just a note: I only joined this group briefly to answer your question as I spent most of today trying to solve the StandardCplusplus issue for an entirely different project. I came across your request for help - so I’m sharing the answer I found.

The error message does tell you what the problem is in a rather cryptic manner - its not obvious but once you know the answer it (of course) becomes obvious. I confirmed what the fix should be by doing differences between the avr-stl and StandardCplusplus ports of the STL (both originate from the uClibc++ Library). avr-stl had fixed this issue 3 years ago so I ported the two lines that need fixing over from avr-stl. I’ve just confirmed the fix with my copy of StandardCplusplus - its now compiling and running OK.

There might be slight differences when you repeat this fix as I cant verify that mine and your versions of StandardCplusplus are the same ones - but the style of the fix should not differ.

Thanks

This seems exactly like the pull-request in the library at Fix up errors with avr-gcc >= 5 regarding C++14 traits behavior by amotl · Pull Request #20 · maniacbug/StandardCplusplus · GitHub, right? If Fix up errors with avr-gcc >= 5 regarding C++14 traits behavior is true than this can also be worked around by downgrading the used compiler toolchain (see docs and toolchain version). Of course, this is a very backwards way of solving the problem.

The other comment in the PR says that the project is dead (last commit from 2013) and is living on as GitHub - mike-matera/ArduinoSTL: An STL and iostream implementation based on uClibc++ that supports my CS-11M class., which should be used.