http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52040

             Bug #: 52040
           Summary: TR1 is not accessible using compiler flags alone
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: pot...@mac.com


C++ TR1 (N1836) §1.3/3-4 says

3. … Users should be required to take explicit action to have access to library
extensions.

4. It is recommended either that additional declarations in standard headers be
protected with a macro that is not defined by default, or else that all
extended headers, including both new headers and parallel versions of standard
headers with nonstandard declarations, be placed in a separate directory that
is not part of the default search path.

<end quote>

The "explicit action" is left open-ended, but the document suggests that mere
inclusion of a nonstandard header should fail.

GCC interprets the explicit action to be prefixing the header name with "tr1/".
This is a change to source code, whereas other platforms such as MSVC allow TR1
to be used without altering the header names.

An alternative way to use GCC would be to pass "-isystem
/usr/include/c++/.../tr1" — instead of modifying the header name, modify the
search path. This fails because, for example, <tr1/cfloat> includes the line

    #include <cfloat>

There are two ways to fix this. One was actually used in some other headers
circa GCC 4.2, and would read:

    #include "../cfloat"

The other is perhaps less clean, but opinions may differ:

    #include_next <cfloat>

Applying either of these fixes across the tr1/ directory should improve source
compatibility.

Reply via email to