Skip to content

[SYCL] Use qualified name of template function call #1062

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

Merged
merged 1 commit into from
Mar 24, 2020

Conversation

smaslov-intel
Copy link
Contributor

This is to fix #1011.

The reason for name conflict is ADL (https://en.cppreference.com/w/cpp/language/adl)
The only reliable way to fix this is to use qualified name.

Signed-off-by: Sergey V Maslov [email protected]

Copy link
Contributor

@bader bader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add a regression test.
I would also enhance original reproducer from #1011 with defining similar function in ::pi namespace before SYCL headers are included.

@bader
Copy link
Contributor

bader commented Feb 18, 2020

Ping.

@smaslov-intel
Copy link
Contributor Author

I will update the review with the test requested

// Usage:
// Operator() - Call, Trace and Get result
// Use Macro PI_CALL_NOCHECK call the constructor directly.
template <typename FnType, size_t FnOffset> class CallPi {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully understand why these changes are present in the diff, is it a result of not fully correct merge from sycl branch?

template <typename TArg0, typename... TArgs>
auto printArgs(TArg0 arg, TArgs... args)
{
//std::cout << 42 << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to either uncomment this line or to completely remove it

@bader
Copy link
Contributor

bader commented Mar 15, 2020

@smaslov-intel, could you address review comments, please?

@smaslov-intel smaslov-intel force-pushed the adl branch 4 times, most recently from af54139 to 0b0cd82 Compare March 22, 2020 05:20
@smaslov-intel
Copy link
Contributor Author

Sorry that it took ages to do this simple change. I think it is ready now.

@bader
Copy link
Contributor

bader commented Mar 22, 2020

@smaslov-intel, the added regression test is empty. Could you upload the content of the test, please?

@garimagu
Copy link
Contributor

garimagu commented Mar 23, 2020

With ADL it seems we can look up for functions in the local scope and in the scope of the arguments.
How is it not preferring a local scope function over global scope in the test case highlighted?
We may see this issue with other functions too right?

@bader bader merged commit 197b24a into intel:sycl Mar 24, 2020
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.

[SYCL] Call to 'printArgs' is ambiguous
4 participants