Doesn't work with Teensyduino core
Opened this issue · 0 comments
maxgerhardt commented
Attempting to use PlatformIO with the latest version of this library and a Teensy2 (ATMega32U4) via
[env:teensy2]
platform = teensy
board = teensy2
framework = arduino
build_unflags = -fno-exceptions -std=gnu++11
build_flags = -DTEENSY_OPT_FASTEST -fexceptions -std=gnu++17
; use a more recent 7.3.0 compiler instead of 5.4.1
platform_packages =
toolchain-atmelavr@~3.70300.0
; fill in missing parts of the standard C++ library
lib_deps =
https://github.com/mike-matera/ArduinoSTL/archive/refs/heads/master.zip
and code src\main.cpp
#include <Arduino.h>
#include <stdexcept>
void setup(){
Serial.begin(9600);
try {
throw std::runtime_error("Test test");
} catch(const std::exception& e) {
Serial.println(e.what());
}
}
void loop(){
}
Results in
In file included from .pio\libdeps\teensy2\ArduinoSTL\src/memory:20:0,
from .pio\libdeps\teensy2\ArduinoSTL\src/char_traits:22,
from .pio\libdeps\teensy2\ArduinoSTL\src/string:21,
from .pio\libdeps\teensy2\ArduinoSTL\src/stdexcept:22,
from src\main.cpp:2:
.pio\libdeps\teensy2\ArduinoSTL\src/new:41:18: error: declaration of 'void operator delete(void*) noexcept' has a different exception specifier
_UCXXEXPORT void operator delete(void* ptr) _UCXX_USE_NOEXCEPT;
^~~~~~~~
In file included from C:\Users\Max\.platformio\packages\framework-arduinoteensy\cores\teensy/Printable.h:26:0,
from C:\Users\Max\.platformio\packages\framework-arduinoteensy\cores\teensy/Print.h:28,
from C:\Users\Max\.platformio\packages\framework-arduinoteensy\cores\teensy/Stream.h:24,
from C:\Users\Max\.platformio\packages\framework-arduinoteensy\cores/usb_serial/usb_api.h:6,
from C:\Users\Max\.platformio\packages\framework-arduinoteensy\cores\teensy/usb_api.h:2,
from C:\Users\Max\.platformio\packages\framework-arduinoteensy\cores\teensy/WProgram.h:22,
from C:\Users\Max\.platformio\packages\framework-arduinoteensy\cores\teensy/Arduino.h:1,
from src\main.cpp:1:
Compiling .pio\build\teensy2\lib265\ArduinoSTL\eh_globals.cpp.o
C:\Users\Max\.platformio\packages\framework-arduinoteensy\cores\teensy/new.h:14:6: note: from previous declaration 'void operator delete(void*)'
void operator delete(void * ptr);
^~~~~~~~
So cores/teensy/new.h
with its declaration of
void operator delete(void * ptr);
seems to be clashing with this library's declaration of
_UCXXEXPORT void operator delete(void* ptr) _UCXX_USE_NOEXCEPT;
Maybe it's possible to detect the Teensyduino core case via TEENSYDUINO
global macro and not declare / define the delete
operator?