Other Parts Discussed in Thread: TM4C1294NCPDT, SYSBIOS
Tool/software: TI C/C++ Compiler
The following code compiles successfully for me using MSVC, but I get the "#28 expression must have a constant value" error with the TI C++ compiler (C++14).
typedef void (*CallbackFunction)();
class Opt
{
public:
constexpr Opt(const int val, const CallbackFunction & callback) :
m_val(val),
m_callback(callback)
{ }
const int m_val;
const CallbackFunction & m_callback;
};
int g_value = 0;
void do_something()
{
g_value++;
}
int main( void )
{
constexpr const Opt opt1 = { 0, do_something };
}
Is there some compiler arg I can specify so that TI ARM compiler knows about function pointers at compile time? Or is this ability just not supported by ARM?
Invoking: ARM Compiler
"C:/ti/ccs1010/ccs/tools/compiler/ti-cgt-arm_20.2.1.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --include_path="C:/ti/tirtos_tivac_2_16_01_14/products/bios_6_45_02_31/packages/ti/sysbios/posix" --include_path="C:/ti/tirtos_tivac_2_16_01_14/products/TivaWare_C_Series-2.1.1.71b" --include_path="C:/ti/ccs1010/ccs/tools/compiler/ti-cgt-arm_20.2.1.LTS/include" --define=DEBUGSUP --define=ccs="ccs" --define=ccs --define=TIVAWARE --define=PART_TM4C1294NCPDT -g --c99 --relaxed_ansi --gcc --diag_suppress=10457 --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi --preproc_with_compile --preproc_dependency="main.d_raw" --include_path="C:/path/to/my/project/Debug/syscfg" --cmd_file="configPkg/compiler.opt" "../main.cpp"