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

Skip client namespace checks for methods with inline body. #206

Merged
merged 1 commit into from
Feb 7, 2024

Conversation

DutChen18
Copy link
Member

The client namespace checks are skipped for functions that have bodies, if FunctionDecl::hasBody() returns true. For the following function, FunctionDecl::hasBody() returns false.

		template<class T, class = std::enable_if_t<cheerp::CanCast<_Function<cheerp::FunctionType<T>>, _Function<F>>>>
		_Function(T&& func) : Function(cheerp::Callback(func)) {
		}

hasInlineBody() does return true, and also skipping the check when hasInlineBody() returns true "fixes" the issue and allows the above code to compile.

I don't really understand why hasBody() returns false here, or why hasInlineBody() does not imply hasBody().

@DutChen18 DutChen18 requested a review from yuri91 February 7, 2024 14:10
@yuri91
Copy link
Member

yuri91 commented Feb 7, 2024

yeah it's peculiar. Even if there is no "body", there is still code that needs to be generated, since arbitrary stuff can be called in the initializer list...

It's probably because that flag is set from a purely syntactical point of view, which sees the body as empty, even if there is an initializer list

@yuri91 yuri91 merged commit ce7efcc into master Feb 7, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants