public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/7136: Template constants deduction
@ 2002-07-03 12:45 nathan
  0 siblings, 0 replies; 5+ messages in thread
From: nathan @ 2002-07-03 12:45 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, philippeb

Synopsis: Template constants deduction

State-Changed-From-To: open->analyzed
State-Changed-By: nathan
State-Changed-When: Wed Jul  3 12:45:05 2002
State-Changed-Why:
    confirmed. still present in 3.1

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: c++/7136: Template constants deduction
@ 2003-01-23 15:06 Wolfgang Bangerth
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Bangerth @ 2003-01-23 15:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/7136; it has been noted by GNATS.

From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: "Philippe A. Bouchard" <philippeb@videotron.ca>
Cc: gcc-bugs@gcc.gnu.org, <gcc-gnats@gcc.gnu.org>
Subject: Re: c++/7136: Template constants deduction
Date: Thu, 23 Jan 2003 09:03:30 -0600 (CST)

 On Thu, 23 Jan 2003, Philippe A. Bouchard wrote:
 
 > Yes you're right but the following won't work either under gcc 2.95:
 > 
 > struct Type
 > {
 >  int i;
 > };
 > 
 > template <typename _T, int _T::* _I>
 >  struct Number {};
 > 
 > template <typename _T, int _T::* _I>
 >  void foo(Number<_T, _I> const &)
 >  {
 >  }
 > 
 > int main()
 > {
 >  foo(Number<Type, & Type::i>());
 > }
 > 
 > Returns:
 > template.cpp: In function `int main()':
 > template.cpp:15: no matching function for call to `foo
 > (Number<Type,&Type::i>)'
 
 True, but there's not much that we can do about it: that's simply a bug in 
 gcc2.95 that was fixed in 3.0. gcc2.95 is not maintained any more, so I 
 fear that you will have to find a workaround for gcc2.95.
 
 W.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth             email:            bangerth@ticam.utexas.edu
                               www: http://www.ticam.utexas.edu/~bangerth/
 
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: c++/7136: Template constants deduction
@ 2003-01-23  5:36 Philippe A. Bouchard
  0 siblings, 0 replies; 5+ messages in thread
From: Philippe A. Bouchard @ 2003-01-23  5:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/7136; it has been noted by GNATS.

From: "Philippe A. Bouchard" <philippeb@videotron.ca>
To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
 nobody@gcc.gnu.org, philippeb@videotron.ca, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/7136: Template constants deduction
Date: Thu, 23 Jan 2003 00:29:38 -0500

 Yes you're right but the following won't work either under gcc 2.95:
 
 struct Type
 {
  int i;
 };
 
 template <typename _T, int _T::* _I>
  struct Number {};
 
 template <typename _T, int _T::* _I>
  void foo(Number<_T, _I> const &)
  {
  }
 
 int main()
 {
  foo(Number<Type, & Type::i>());
 }
 
 Returns:
 template.cpp: In function `int main()':
 template.cpp:15: no matching function for call to `foo
 (Number<Type,&Type::i>)'
 
 
 
 Philippe
 
 
 ----- Original Message -----
 From: <bangerth@dealii.org>
 To: <gcc-bugs@gcc.gnu.org>; <gcc-prs@gcc.gnu.org>; <nobody@gcc.gnu.org>;
 <philippeb@videotron.ca>
 Sent: Wednesday, January 22, 2003 10:16 PM
 Subject: 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&p
 r=7136
 >
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: c++/7136: Template constants deduction
@ 2003-01-23  3:16 bangerth
  0 siblings, 0 replies; 5+ messages in thread
From: bangerth @ 2003-01-23  3:16 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, philippeb

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* c++/7136: Template constants deduction
@ 2002-06-26 23:06 philippeb
  0 siblings, 0 replies; 5+ messages in thread
From: philippeb @ 2002-06-26 23:06 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7136
>Category:       c++
>Synopsis:       Template constants deduction
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 26 19:26:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     g++
>Release:        gcc version 2.95.4 20011006 (Debian prerelease)
>Organization:
>Environment:
Linux 2.2.19pre17 i686
>Description:
Pointer to member template constants are not properly resolved.  The compiler returns:

template.cpp:18: type/value mismatch at argument 2 in template parameter list for `template<_T, int _T::*<anonymous> > struct Number'
template.cpp:18:   expected a constant of type `int _T::*', got `int _T::*'
template.cpp:19: ISO C++ forbids declaration of `parameter' with no type
template.cpp: In function `int main()':
template.cpp:27: no matching function for call to `foo(Number<Type, &Type::i>)'
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="template.cpp"
Content-Disposition: inline; filename="template.cpp"

#include <iostream>

using namespace std;


struct Type
{
int i;
};

template <typename _T, int _T::*>
struct Number
{
};


template <typename _T, int _T::*>
void foo(Number<_T, int _T::*> const &)
{
cout << __PRETTY_FUNCTION__ << endl;
}



int main()
{
foo(Number<Type, & Type::i>());

return 0;
}



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-01-23 15:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-03 12:45 c++/7136: Template constants deduction nathan
  -- strict thread matches above, loose matches on Subject: below --
2003-01-23 15:06 Wolfgang Bangerth
2003-01-23  5:36 Philippe A. Bouchard
2003-01-23  3:16 bangerth
2002-06-26 23:06 philippeb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).