ETLCPP / etl

Embedded Template Library
https://www.etlcpp.com
MIT License
2.25k stars 392 forks source link

etl::variant throws error during compilation with IAR 9.40.1 #771

Open H0ppl opened 1 year ago

H0ppl commented 1 year ago

Hi, I have issues with etl::variant and IAR 9.40.1.

I have the following etl_profile:

#ifndef ETL_PROFILE_H
#define ETL_PROFILE_H

#define ETL_TARGET_DEVICE_GENERIC
#define ETL_TARGET_OS_NONE
#define ETL_CPP11_SUPPORTED 1
#define ETL_CPP14_SUPPORTED 1
#define ETL_CPP17_SUPPORTED 0
#define ETL_COMPILER_IAR

#endif

When I try to compile the project just with the necessary include for etl::variant #include "etl/variant.h", I get the following error, poiting to U8 in include\etl\private\variant_legacy.h",163:

template <typename U1, typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8> ^ "Error[Pe040]: expected an identifier

When I remove the #include "private/variant_legacy.h" in variant.h, the code is compiling without errors:

#ifndef ETL_VARIANT_INCLUDED
#define ETL_VARIANT_INCLUDED

#include "platform.h"

#if !ETL_USING_CPP11 || defined(ETL_USE_LEGACY_VARIANT)
  #include "private/variant_legacy.h"  // etl::variant
#else
  //#include "private/variant_legacy.h"   // etl::legacy::variant -> removed
  #include "private/variant_variadic.h"  // etl::variant
#endif

#endif

Not sure if the include here is correct or if there's another error in my code or cmake configuration which leads to the compilation problem.

jwellbelove commented 1 year ago

I will try to download the relevant IAR compiler.