This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: other/9274: [pch] Big troubles with v3


Synopsis: [pch] Big troubles with v3

State-Changed-From-To: open->analyzed
State-Changed-By: bkoz
State-Changed-When: Tue Jan 28 03:45:59 2003
State-Changed-Why:
    I ran into this too. This problem makes pch unusable for g++/libstdc++.
    
    Take the following:
    %COMP.sh "-x c++-header -Winvalid-pch" ostream
    /mnt/hd/ahimsa/bld-x86-gcc/i686-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:149: warning: inline
       function `const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = size_t]' 
       used but never defined
    /mnt/hd/ahimsa/bld-x86-gcc/i686-pc-linux-gnu/libstdc++-v3/include/cmath:391: warning: inline
       function `_Tp std::__pow_helper(_Tp, int) [with _Tp = float]' used but never    defined
    /mnt/hd/ahimsa/bld-x86-gcc/i686-pc-linux-gnu/libstdc++-v3/include/cmath:391: warning: inline
       function `_Tp std::__pow_helper(_Tp, int) [with _Tp = long double]' used but    never defined
    
    
    So I think, hmm, this is odd, never had this problem before. 
    
    I take a look at the pre-processed output, and make sure that the template definition of max is declared, and defined, before first use.
    
    Check. In stl_algobase.h, 148:
    
      #undef min
      #undef max
    
      /**
       *  @brief This does what you think it does.
       *  @param  a  A thing of arbitrary type.
       *  @param  b  Another thing of arbitrary type.
       *  @return   The lesser of the parameters.
       *
       *  This is the simple classic generic implementation.  It will work on
       *  temporary expressions, since they are only evaluated once, unlike a
       *  preprocessor macro.
      */
      template<typename _Tp>
        inline const _Tp&
        min(const _Tp& __a, const _Tp& __b)
        {
          // concept requirements
          __glibcpp_function_requires(_LessThanComparableConcept<_Tp>)
          //return __b < __a ? __b : __a;
          if (__b < __a) return __b; return __a;
        }
    
    Removing the "inline" keyword from the declaration gets past this, but kind of kills the point of this function, and the value of pch in general.
    
    -benjamin

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9274


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]