[Bug libstdc++/59087] Issues including complex.h in C++11/1y mode because of C's complex.h

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 10 11:26:00 GMT 2017


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

--- Comment #18 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Tue Oct 10 11:25:45 2017
New Revision: 253581

URL: https://gcc.gnu.org/viewcvs?rev=253581&root=gcc&view=rev
Log:
PR libstdc++/82417 do not include C99 <complex.h> in strict modes

As an extension the C++ version of <complex.h> includes the C version,
but that defines macros with non-reserved names that should not be
defined in ISO C++. Only include the C header for non-strict modes, or
for pre-C++11 (because C++98 doesn't mention <complex.h> at all).

        PR libstdc++/59087
        PR libstdc++/82417
        * include/c_compatibility/complex.h [!C++98 && __STRICT_ANSI__]: Do
        not include C library's <complex.h>.
        * testsuite/26_numerics/complex/c99.cc: Depend on __STRICT_ANSI__.
        * testsuite/26_numerics/headers/complex.h/std_c++11.h: New test.
        * testsuite/26_numerics/headers/complex.h/std_gnu++11.h: New test.
        * testsuite/26_numerics/headers/complex.h/std_c++98.h: New test.

Added:
    trunk/libstdc++-v3/testsuite/26_numerics/headers/complex.h/
    trunk/libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++11.h
      - copied, changed from r253550,
trunk/libstdc++-v3/testsuite/26_numerics/complex/c99.cc
    trunk/libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++98.h
      - copied, changed from r253550,
trunk/libstdc++-v3/testsuite/26_numerics/complex/c99.cc
    trunk/libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_gnu++11.h
      - copied, changed from r253550,
trunk/libstdc++-v3/testsuite/26_numerics/complex/c99.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/c_compatibility/complex.h
    trunk/libstdc++-v3/testsuite/26_numerics/complex/c99.cc


More information about the Gcc-bugs mailing list