From 91c9a458f0ec93d05bd778b44c18ef7d00a180f4 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Sat, 25 Feb 2023 00:09:29 +0300 Subject: [PATCH] Fix `error: reinterpret_cast from 'const __FlashStringHelper *' (aka 'const __attribute__((address_space(1))) char *') to 'const char *' is not allowed` when compiling with Clang --- cores/arduino/Print.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cores/arduino/Print.cpp b/cores/arduino/Print.cpp index 1e4c99a65..a2bee6c8f 100644 --- a/cores/arduino/Print.cpp +++ b/cores/arduino/Print.cpp @@ -43,7 +43,11 @@ size_t Print::write(const uint8_t *buffer, size_t size) size_t Print::print(const __FlashStringHelper *ifsh) { + #if defined(__clang__) + PGM_P p = (PGM_P)(ifsh); + #else PGM_P p = reinterpret_cast(ifsh); + #endif size_t n = 0; while (1) { unsigned char c = pgm_read_byte(p++);