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: c++/7136: Template constants deduction


Synopsis: Template constants deduction

State-Changed-From-To: analyzed->closed
State-Changed-By: bangerth
State-Changed-When: Thu Jan 23 03:16:59 2003
State-Changed-Why:
    Nathan must have been having his afternoon nap when he
    confirmed this report :-)
    
    The code is actually illegal, and gcc tells you quite
    correctly what is wrong:
    -----------------------------
    struct Type { int i; };
    
    template <typename _T, int _T::*>
    struct Number {};
    
    template <typename _T, int _T::*>
    void foo(Number<_T, int _T::*> const &)
    {}
    
    int main() {
      foo(Number<Type, &Type::i>());
    }
    ------------------------------
    
    In the argument list to foo(), the second template
    parameter to Number is "int T::*", which is a type, not
    a value. That's what the compiler is complaining about. In
    the call to foo(), the second argument is a value, as it
    should be.
    
    W.

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


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