Skip to main content
AKlep.1
Associate
November 19, 2020
Question

Fold Expression not working

I am using IDE 1.5.0 with the -std=gnu++17 flag set

When trying to use fold expression, the compiler throws an error.

This topic has been closed for replies.

5 replies

KnarfB
Super User
November 19, 2020

I'm not keen on new language features, but a simple test worked when test() called from main():

 template <typename... Ty>
 auto sum(Ty... args) {
 return (args + ...);
 }
 
 extern "C" int test()
 {
	 return sum(1,2,3);
 }

This is more a g++ question rather than STM.

Cartu38 OpenDev
Graduate II
November 19, 2020

STM32CubeIDE 1.5.0 (1.4.2 is fine too) no issue to me if C++17 usage. According to me proper g++ switch is "-std=c++17" not "-std=gnu++17"

0693W000005C2WmQAK.jpg

AKlep.1
AKlep.1Author
Associate
November 19, 2020

0693W000005C2YOQA0.pngIt doesn't work for me and on -std = c ++ 17

AKlep.1
AKlep.1Author
Associate
November 19, 2020

Correction: works, but IDE emphasizes fold expression. Apparently we should expect further fixes.

Cartu38 OpenDev
Graduate II
November 19, 2020

Compiler (gcc/g++ here) is one thing, C editor code analysis engine another ...

Maybe CDT is late here (but 2017 post) ? https://www.eclipse.org/community/eclipse_newsletter/2017/april/article3.php

https://www.eclipse.org/forums/index.php/t/1086577/