public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: oliver.schoenborn@utoronto.ca
To: gcc-gnats@gcc.gnu.org
Subject: c++/9460: parse error on template member function
Date: Mon, 27 Jan 2003 19:26:00 -0000	[thread overview]
Message-ID: <20030127191803.16042.qmail@sources.redhat.com> (raw)


>Number:         9460
>Category:       c++
>Synopsis:       parse error on template member function
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 27 19:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Oliver Schoenborn
>Release:        3.2.2 on cygwin, 3.2 linux, 3.0.4 SGI
>Organization:
>Environment:
Cygwin (latest), linux redhat 7.3, SGI Irix 6.5.13
>Description:
struct Test
{
    template <typename T>
    void test(T*) {}
};

template <typename ObjType>
struct Foo
{
    Test _state;
    int _i;
    
    void reset()
    {
        _state.test(&_i); // ok
        _state.test<ObjType>(&_i); // parse error here if...
    }
    
    // ... and only if following is not 
    // same name as Test::test!!!!
    template <typename TT>
    void test2() {}
};
    
int main()
{
    Foo<int> test;
    test.reset();
}

>How-To-Repeat:
Just try to compile the file with "g++ -c file.cc"
>Fix:
none except hack: add extra parameters to function so it can deduce template parameter

Colleague has reported that these may work too (not tested rigorously):
_state.template test<ObjType>(&_i); //avoids the error
_state.Test::test<ObjType>(&_i); //avoids the error


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


             reply	other threads:[~2003-01-27 19:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-27 19:26 oliver.schoenborn [this message]
2003-01-27 19:55 bangerth
2003-01-28  2:36 Farfetch'd
2003-01-28 21:16 Wolfgang Bangerth
2003-01-28 21:16 Wolfgang Bangerth
2003-01-29  9:16 Giovanni Bajo
2003-01-29 15:46 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=20030127191803.16042.qmail@sources.redhat.com \
    --to=oliver.schoenborn@utoronto.ca \
    --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).