public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: maudouy@amadeus.net
To: gcc-gnats@gcc.gnu.org
Subject: c++/9660: use of template keyword to specify templated method cause ICE
Date: Tue, 11 Feb 2003 10:36:00 -0000	[thread overview]
Message-ID: <20030211102839.12289.qmail@sources.redhat.com> (raw)


>Number:         9660
>Category:       c++
>Synopsis:       use of template keyword to specify templated method cause ICE
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 11 10:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     maudouy@amadeus.net
>Release:        gcc 3.0.1
>Organization:
>Environment:
HP-UX B.11.11
>Description:

the use of "template" keyword for template specialisation appearing in a postfix expression (ISO 14882 14.2.4) is causing an internal compiler error.

the attached file, compiled without options, reproduce the ICE.

>How-To-Repeat:

>Fix:
an easy workaround is not to use the template keyword, it works in this case. but when using other compilers (like aCC on HP-UX) it is necessary.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="templateBug.cpp"
Content-Disposition: inline; filename="templateBug.cpp"


namespace TOTO {

    template <typename ObjectType,
    	  typename FirstArgumentType,
	  typename SecondArgumentType>
    ObjectType& 
    create(FirstArgumentType & firstArg,
           SecondArgumentType & secondArg)
    {
    	ObjectType & ref = *(new ObjectType(firstArg, secondArg));
    	return ref;
    }
}

namespace FOO {

class A {
public:
    int x_;
    int y_;
    A(int& x, int& y):x_(x),y_(y) {}	    
};


class B {
public:
    A& getA(int a, int b)
    {
        A& anA = TOTO::template create<A>(a,b);
        return anA;
    }	
};

}

int main() {
    FOO::B b;
    FOO::A& anA = b.getA(2,3);
}


             reply	other threads:[~2003-02-11 10:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-11 10:36 maudouy [this message]
2003-02-11 10:56 Gabriel Dos Reis
2003-02-11 11:06 MAudouy
2003-02-14 21:01 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=20030211102839.12289.qmail@sources.redhat.com \
    --to=maudouy@amadeus.net \
    --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).