public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: sts@ica1.uni-stuttgart.de
To: gcc-gnats@gcc.gnu.org
Subject: c++/3614: failing overloading of template member functions in template classes
Date: Mon, 09 Jul 2001 02:56:00 -0000	[thread overview]
Message-ID: <20010709095105.511.qmail@sourceware.cygnus.com> (raw)

>Number:         3614
>Category:       c++
>Synopsis:       failing overloading of template member functions in template classes
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 09 02:56:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     sts@ica1.uni-stuttgart.de
>Release:        gcc-3.0
>Organization:
>Environment:
alpha OSF 5.0, ix86-linux
>Description:
// I cannot see a problem with the syntax of the following 
// fragment; shouldn't one be able to overload template and 
// non-template functions in class scopes and be able to declare 
// them out of line?  From the examples in Sec. 14 of the standard
// my guess is that the fragment below uses the syntax intended for 
// this purpose. EDG compilers treat this fragment as I expect (the 
// executable returns 0 to the environent)

// the _inline_ definition of the functions IN the class 
// body works as expected

// Stefan Schwarzer sts@ica1.uni-stuttgart.de

// 11:30 tiger_sts:gnu/current> 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

// 11:30 tiger_sts:gnu/current> g++ class_tmpl_ovld.cc
// class_tmpl_ovld.cc:28: redefinition of `int A<N>::f()'
// class_tmpl_ovld.cc:25: `int A<N>::f()' previously declared here
// class_tmpl_ovld.cc:28: expected 2 levels of template parms for `int A<N>::f()
', 
//   got 1
// class_tmpl_ovld.cc:20: confused by earlier errors, bailing out



template<int N>
struct A {

  int f();  

  template<int M>
  int f();

};

template<int N> template<int M>
int A<N>::f(){ return M; } 

template<int N>
int A<N>::f(){ return 1; }

// should compile and return 0
int main(){
  A<42> a;
  return a.f<0>();
}
>How-To-Repeat:
see problem description
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2001-07-09  2:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-09  2:56 sts [this message]
2001-08-12  4:04 gdr
2002-11-21 19:06 Wolfgang Bangerth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010709095105.511.qmail@sourceware.cygnus.com \
    --to=sts@ica1.uni-stuttgart.de \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).