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   | 
		 
		
			
				
				
				
					
						  
						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  
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 06:40:36 CET 2025 
 Total time taken to generate the page: 0.05260 seconds 
 |