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

__has_include should not error if unevaluated #134510

Open
kyuupichan opened this issue Apr 5, 2025 · 4 comments
Open

__has_include should not error if unevaluated #134510

kyuupichan opened this issue Apr 5, 2025 · 4 comments
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@kyuupichan
Copy link

If /tmp/unreadable.cpp is unreadable (e.g. because chmod a-r) then clang gives a fatal error on this conditional. GCC gets this right and is silent only because the __has_include is unevaluated.

#if 0 && __has_include("/tmp/unreadable.cpp")
#endif

@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" and removed new issue labels Apr 5, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 5, 2025

@llvm/issue-subscribers-clang-frontend

Author: Neil Booth (kyuupichan)

If /tmp/unreadable.cpp is unreadable (e.g. because chmod a-r) then clang gives a fatal error on this conditional. GCC gets this right and is silent only because the __has_include is unevaluated.

#if 0 && __has_include("/tmp/unreadable.cpp")
#endif

@Agent-Hellboy
Copy link

Hey, I am exploring llvm these days and i want to try this issue.

@kyuupichan
Copy link
Author

It might be tricky as I think the problem is that the processing of _has_include isn't taking place in the context of the expression evaluator (which is where it should be, IMO).

@Agent-Hellboy
Copy link

It might be tricky as I think the problem is that the processing of _has_include isn't taking place in the context of the expression evaluator (which is where it should be, IMO).

No problem, I can at least try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"
Projects
None yet
Development

No branches or pull requests

4 participants