Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: forward reference to inferred return type of function call #67

Closed
timotheecour opened this issue Jan 11, 2018 · 1 comment
Closed

Comments

@timotheecour
Copy link
Collaborator

test.h:

#define tims_my_def2(x) (2*x)

template<typename T> auto _tims_my_def2(const T& x){
  return tims_my_def2(x);
}

main.d:

modmap (C++) "test3.h";
import (C++) _;
void main(){
  //  (compiled with `-cpp-args=-std=c++14`)
  // Error: forward reference to inferred return type of function call '_tims_my_def2(3)'
  auto a=_tims_my_def2(3);
}

workaround: use this (with -cpp-args=-std=c++11)

template <class T>
constexpr auto _tims_my_def2(const T& x) -> decltype(tims_my_def2(x)) {
	return tims_my_def2(x);
}
Syniurge added a commit that referenced this issue Jan 22, 2018
…tion body before mapping the instantiated function type during deduceFunctionTemplateMatch().
@Syniurge
Copy link
Owner

Fixed!

Syniurge added a commit that referenced this issue Jan 22, 2018
…tion body before mapping the instantiated function type during deduceFunctionTemplateMatch().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants