-
-
Notifications
You must be signed in to change notification settings - Fork 116
Closed
Description
Hi,
I'm been changing from an ESP32/Arduino environment into an ESP32/esp-idf environment that has support for Arduino-code, and so far everything has been smooth, except for this library.
Somehow, the compiler trips over the following code:
#define DEFINE_FIELD(fieldname, value_t, obis, field_t, field_args...) \
struct fieldname : field_t<fieldname, ##field_args> { \
value_t fieldname; \
bool fieldname ## _present = false; \
static constexpr ObisId id = obis; \
static constexpr char name_progmem[] DSMR_PROGMEM = #fieldname; \
static constexpr const __FlashStringHelper *name = reinterpret_cast<const __FlashStringHelper*>(&name_progmem); \
value_t& val() { return fieldname; } \
bool& present() { return fieldname ## _present; } \
}
at the reinterpret_cast<.... part it gives me this error:
.pio/libdeps/switch-1/Dsmr/src/dsmr/fields.h:185:56: error: a reinterpret_cast is not a constant expression
static constexpr const __FlashStringHelper *name = reinterpret_cast<const __FlashStringHelper*>(&name_progmem); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.pio/libdeps/switch-1/Dsmr/src/dsmr/fields.h:231:1: note: in expansion of macro 'DEFINE_FIELD'
DEFINE_FIELD(electricity_long_failures, uint32_t, ObisId(0, 0, 96, 7, 9), IntField, units::none);
What i've tried/checked
- The build flags for the GCC compiler (C++11) for the Arduino environment and for the esp-idf environment are the same: gcc 8.2.0
- the __FlashStringHelper is present, and is the same as before
- The DEFINE_FIELD() functions where the DEFINE_FIELD macro is used, expand to the same code in both environments.
Could you give me any hints where i should look to solve this issue?
Metadata
Metadata
Assignees
Labels
No labels