Are fold expressions supported ?


I’m trying to write a variadic function template that would fold a parameter pack over an expression
However, the compiler fails on the fold expression
Since my function is a little complex, I tried with a much simpler one (copied from cppreference), but that didn’t work either, so there clearly seems to be a problem with fold expressions in UE
Here are the function and the error

	template<typename... Args>
	bool all(Args ...args) {
			return (... && args);     //fails here

error: error C2059: syntax error: '...'

I’m not trying to have this function exposed in blueprint, it is just used internally in my code

This error doesn’t seem to be new with UE5, someone has the same problem in UE4 : Problems with fold expressions in c++

So I wanted to know if it’s normal, if fold expressions aren’t supported on UE
If it is indeed possible (or should be possible), is it a bug, an error on my side or is there a special syntax or workaround ?


You can try this in you build.cs file

CppStandard = CppStandardVersion.Cpp17;

Oh thanks, I didn’t knew about this
I thought adding the compiler option /std:c++17 to my VS project was enough

But then, is C++20 supported ?