From 3290e3423200ecd4f3e0df2612c95bf0b32d8f09 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 --- api/Print.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/Print.cpp b/api/Print.cpp index 8c3e1930..efdd6366 100644 --- a/api/Print.cpp +++ b/api/Print.cpp @@ -41,7 +41,11 @@ size_t Print::write(const uint8_t *buffer, size_t size) size_t Print::print(const __FlashStringHelper *ifsh) { #if defined(__AVR__) + #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++);