Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-936

[Sun C++] fails to #include standard headers more than once

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • External
    • None
    • Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25

    • Incorrect Behavior

    Description

      The program below fails to compile with Sun C++. The compiler assumes <limits> refers to its own header rather than the one provided by the user in the same directory as the program source code, t.cpp.

      $ cat -n limits && cat -n t.cpp && CC -c -I. -library=%none -V t.cpp
           1  // limits
           2  static int foo = 0;
           1  // t.cpp
           2  #include <limits>
           3  #define foo bar
           4  #include <limits>
           5  #undef foo
           6  
           7  int main ()
           8  {
           9      return foo + bar;
          10  }
      CC: Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25
      ccfe: Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25
      "t.cpp", line 9: Error: bar is not defined.
      1 Error(s) detected.
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              sebor Martin Sebor
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: