Skip to content

modules: #pragma once must appear before #ifdef when using -fmodules #38532

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

Open
andrewjcg opened this issue Oct 4, 2018 · 1 comment
Open
Labels
bugzilla Issues migrated from bugzilla clang:modules C++20 modules and Clang Header Modules

Comments

@andrewjcg
Copy link
Contributor

Bugzilla Link 39184
Version trunk
OS All
CC @DougGregor

Extended Description

When compiling with -fmodules (but not necessarily actually building modules), #pragma once guards don't work when appearing after a #ifdef ... guard. Example failing test: https://reviews.llvm.org/differential/diff/168367/.

I couldn't find any supporting documentation saying that #pragma once must come first, but assuming this is true, then this probably isn't a bug (but maybe should then be a warning?).

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@davidstone
Copy link
Contributor

davidstone commented Mar 11, 2023

Given #38554, #pragma once doesn't work before the #ifdef guard, either, so this might just be a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:modules C++20 modules and Clang Header Modules
Projects
None yet
Development

No branches or pull requests

2 participants