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

            Bug ID: 89806
           Summary: Different behaviour for "pragma diagnostic disabled"
                    between gcc and g++
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nbkolchin at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/J0xdIL

Sample code:

#pragma GCC diagnostic ignored "-Wdate-time"
const char* g_test = "dirty-" __DATE__;

When compiling with g++ (g++ -Werror=date-time) this produces:

<source>:2:31: error: macro "__DATE__" might prevent reproducible builds
[-Werror=date-time]

    2 | const char* g_test = "dirty-" __DATE__;

      |                               ^~~~~~~~

cc1plus: some warnings being treated as errors

Compiler returned: 1

But with GCC this compiles without errors (gcc -Werror=date-time).
https://godbolt.org/z/a4ZymR

Reply via email to