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

[gcc 4.7.1/Linux] 22.locale.collate.cpp compilation failure

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 4.2.x, 4.3.x, 5.0.0
    • 4.2.x, 4.3.x, 5.0.0
    • Tests
    • None
    • $ uname -a; gcc -v 2>&1 | tail -n 1
      Linux behemoth 2.6.37.6 #3 SMP Sat Apr 9 22:49:32 CDT 2011 x86_64 AMD Opteron(tm) Processor 6134 AuthenticAMD GNU/Linux
      gcc version 4.7.1 (GCC)

    • Patch Available
    • Compiler Error

    Description

      Definitions of support template function occur after their use. The following test case fails:

      $ cat test.cpp; gcc -c test.cpp
      template < class charT >
      void f ()
      {
          g (charT ('a'));
      }
      
      template < class charT >
      void g (charT)
      {
      }
      
      int h ()
      {
          return f< char > (), 0;
      }
      test.cpp: In instantiation of 'void f() \[with charT = char\]':
      test.cpp:14:23:   required from here
      test.cpp:4:5: error: 'g' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation \[-fpermissive\]
      test.cpp:8:6: note: 'template<class charT> void g(charT)' declared here, later in the translation unit
      

      The culprits are test_hash, test_weight_val, etc. Comeau and gcc fail, icc and SUNPro CC pass.

      Attachments

        1. patch.diff
          0.8 kB
          Liviu Nicoara

        Activity

          People

            Unassigned Unassigned
            nikkoara Liviu Nicoara
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified