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

[gcc/Linux] std::tm not declared in <cwchar>

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.1.3
    • 4.2.0
    • 21. Strings
    • None
    • Linux, gcc 3.4.6 - 4.1.2

    Description

      getting this error:

      /home/scottz/stdcxx/tests/strings/21.cwchar.cpp:568: error: reference to 'tm' is ambiguous
      /usr/include/../include/time.h:135: error: candidates are: struct tm
      /home/scottz/stdcxx/tests/strings/21.cwchar.cpp:550: error: struct Fallback::tm
      /home/scottz/stdcxx/tests/strings/21.cwchar.cpp:568: error: reference to 'tm' is ambiguous
      /usr/include/../include/time.h:135: error: candidates are: struct tm
      /home/scottz/stdcxx/tests/strings/21.cwchar.cpp:550: error: struct Fallback::tm
      /home/scottz/stdcxx/tests/strings/21.cwchar.cpp:568: error: 'tm' does not name a type
      /home/scottz/stdcxx/tests/strings/21.cwchar.cpp:577: error: 'test_tm' in namespace 'std::Nested' does not name a type

      -----------------------------------------------------------------------------------------

      Martin Sebor [m...@roguewave.com]

      I was able to reproduce the same error with gcc 3.4.6.

      The purpose of the test is to verify the conformance of the <cwchar> header WRT namespace cleanliness (i.e., that symbols like struct tm are defined in namespace std and not also in the global scope). The test is designed to fail at runtime (via assertions) rather than at compile time but it looks like the implementation of the test (or maybe even its
      design) is broken. In any case, the fact that the test doesn't compile suggests there is a problem with the header.
      The compilation errors for the simple program below confirm this. Can you open an issue for this problem and reference this thread in the archive in the issue?

      $ cat t.cpp && nice make t
      #include <cwchar>

      int main ()
      {
      std::tm tmb =

      { 0 };
      }

      gcc -c -I/amd/devco/sebor/stdcxx/include/ansi -D_RWSTDDEBUG -I/amd/devco/sebor/stdcxx/include -I/build/sebor/stdcxx-gcc-3.4.6-11S/include
      -I/amd/devco/sebor/stdcxx/../rwtest
      -I/amd/devco/sebor/stdcxx/../rwtest/include
      -I/amd/devco/sebor/stdcxx/tests/include -pedantic -nostdinc++ -g -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long
      -Wcast-align t.cpp
      t.cpp: In function `int main()':
      t.cpp:5: error: `tm' is not a member of `std'
      t.cpp:5: error: expected `;' before "tmb"
      make: *** [t.o] Error 1

      Thanks
      Martin

      $ cat t.cpp && nice make t
      #include <cwchar>

      int main ()
      {
      std::tm tmb = { 0 }

      ;
      }

      Attachments

        Activity

          People

            farid Farid Zaripov
            scottz Scott (Yu) Zhong
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: