https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125775

            Bug ID: 125775
           Summary: Precompiled header is not used when -Wpedantic is
                    enabled
           Product: gcc
           Version: 16.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: maxxdem2020 at gmail dot com
  Target Milestone: ---

Created attachment 64727
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64727&action=edit
pch.ii and a-main.ii produced from the 2 commands

Running the following 2 commands:

g++ -v pch.hpp -c
g++ -save-temps main.cpp -include pch.hpp -Wall -Wextra -Wpedantic
-Winvalid-pch

Produces the following warning:

cc1plus: warning: ./pch.hpp.gch: not used because ‘__cpp_runtime_arrays’ not
defined [-Winvalid-pch]

However, removing -Wpedantic from the 2nd command OR adding -save-temps to the
1st command makes the warning go away and the PCH seems to be used.

main.cpp and pch.hpp are just this:

// main.cpp
int main() {
    return 0;
}

// pch.hpp
#include <iostream>

Reply via email to