Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Gökhan_Ö_
Beginner
67 Views

[Bug Report] Function Declarations w/ Trailing Return Types

The following snippet should compile, it does not compile => sad face.

template<typename... Args>
struct S
{
	void f(Args... args); // This declaration of f is fudging it up.
	//auto f(Args... args) -> void; // This declaration on the other hand works.
};

template<typename... Args>
inline auto S<Args...>::f(Args... args) -> void
{
	f(args...);
}

int main()
{
	S<int> s;
	s.f(0);
	return 0;
}
0 Kudos
1 Reply
Judith_W_Intel
Employee
67 Views

 

What version of the compiler are you using (do an icc -v)?

I think this was fixed back in January by this fix:

1/15/16
Redeclarations of variadic function templates

When a variadic function template is redeclared using a form that is slightly
different from the original declaration, the front end sometimes corrupted the
type of the function template, causing the variadic nature of parameters to
be lost and incorrect deduction behavior later on.  For example:

  template<typename ...  Ts> void f(Ts&&...);
  template<typename ...  Ts> auto f(Ts&&...)->void {}
  void g() {
    f(1, 2);  // Previously triggered a spurious error.  Now okay.
  }

This is now fixed.

If you are using an older compiler, please get the latest 16.0 update.

sorry for the trouble.

Judy

 

Reply