public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/3793: template class rejected as template arg to a template member
@ 2001-07-24  9:46 sts
  0 siblings, 0 replies; 2+ messages in thread
From: sts @ 2001-07-24  9:46 UTC (permalink / raw)
  To: gcc-gnats

>Number:         3793
>Category:       c++
>Synopsis:       template class rejected as template arg to a template member
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 24 09:46:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Stefan Schwarzer
>Release:        gcc-3.0
>Organization:
>Environment:
alpha osf5.0, x86-linux
>Description:
The following segment attempts to invoke a template member
of a base class with an explicit template 
argument. g++-3.0 produces a syntax error (which btw. is 
slightly different, if the body of the function 'worker' 
is defined outside class B). IMHO and that of edg frontends,
the code is legal.

18:35 margay_sts:~/bugs/gnu> uname -a 
OSF1 margay.ica1.uni-stuttgart.de V5.0 910 alpha
18:35 margay_sts:~/bugs/gnu> g++ -v
Reading specs from /local/gcc-3.0/lib/gcc-lib/alphaev56-dec-osf4.0f/3.0/specs
Configured with: /share/src/gcc-3.0/configure --prefix=/local/gcc-3.0 --host=alphaev56-dec-osf4.0f --target=alphaev56-dec-osf4.0f
Thread model: single
gcc version 3.0
18:35 margay_sts:~/bugs/gnu> g++ tt.cc
tt.cc: In member function `virtual double B<T>::worker()':
tt.cc:16: parse error before `;' token
18:35 margay_sts:~/bugs/gnu> cat tt.cc

template<class T>
struct A{

  template<class U>
  double helper(){ return 42.; }

}; 


template<class T>
struct B : A<T> {

  virtual double worker()
  {
    return A<T>::helper< B >();
  }

};


int main(){
  B<double>  b;
  b.worker();
}
>How-To-Repeat:
try to  compile the code given in the project description
on Linux or Alpha platforms
>Fix:
I wish I knew...
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c++/3793: template class rejected as template arg to a template member
@ 2001-08-13 13:53 gdr
  0 siblings, 0 replies; 2+ messages in thread
From: gdr @ 2001-08-13 13:53 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, gdr, nobody, sts

Synopsis: template class rejected as template arg to a template member

Responsible-Changed-From-To: unassigned->gdr
Responsible-Changed-By: gdr
Responsible-Changed-When: Mon Aug 13 13:53:02 2001
Responsible-Changed-Why:
    Boo!
State-Changed-From-To: open->closed
State-Changed-By: gdr
State-Changed-When: Mon Aug 13 13:53:02 2001
State-Changed-Why:
    This is not a compiler bug; it is an error in your proggram.
    This is one of the rare places where Standard C++ requires the following syntax
    
       return A<T>::template helper<B>();
    
    Yes, it is a bit weird, but that is the way C++ reads.
    
    -- Gaby

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3793&database=gcc


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

end of thread, other threads:[~2001-08-13 13:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-24  9:46 c++/3793: template class rejected as template arg to a template member sts
2001-08-13 13:53 gdr

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).