Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » MSVS15x64: Compile Error C3256 C3259 C3250 in Fn.h findarg
MSVS15x64: Compile Error C3256 C3259 C3250 in Fn.h findarg [message #57131] Fri, 28 May 2021 12:34 Go to previous message
wqcmaster is currently offline  wqcmaster
Messages: 37
Registered: March 2013
Member
Hi,

is there an error here?
No error is thrown under the CLANG compiler; if the MSVS15x64 compiler is used, several errors are thrown.

Upp Version: 15947
Package Core
File "Fn.h"

template <class T, class K, typename... L>
constexpr int findarg(const T& sel, const K& k, const L& ...args)
{
	if(sel == k)
		return 0;
	int q = findarg(sel, args...);
	 return q >= 0 ? q + 1 : -1;
}


threw the following error:
...Fn.h (58): error C3256: "q": Variablenverwendung ergibt keinen konstanten Ausdruck
...Fn.h (53): error C3259: "constexpr"-Funktionen können nur eine return-Anweisung aufweisen.
...Fn.h (57): error C3250: "q": Deklaration ist im "constexpr"-Funktionstext nicht zulässig


But if the function is changed as follows:
template <class T, class K, typename... L>
constexpr int findarg(const T& sel, const K& k, const L& ...args)
{
	return (sel == k) ? 0 : findarg(sel, args...) >= 0 ? findarg(sel, args...) + 1 : -1;
}

-> no error is displayed when compiling.

[Updated on: Fri, 28 May 2021 12:40]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message icon14.gif
Read Message
Read Message
Previous Topic: SIGPIPE problem
Next Topic: Jsonize() Date and Time serialization [patch]
Goto Forum:
  


Current Time: Sat May 04 13:55:41 CEST 2024

Total time taken to generate the page: 0.03554 seconds