public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: morgan@sten.sunnybrook.utoronto.ca
To: gcc-gnats@gcc.gnu.org
Subject: c++/9510: Compilation fails when calling member function templated on integer
Date: Thu, 30 Jan 2003 17:36:00 -0000	[thread overview]
Message-ID: <20030130172644.9167.qmail@sources.redhat.com> (raw)


>Number:         9510
>Category:       c++
>Synopsis:       Compilation fails when calling member function templated on integer
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 30 17:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     morgan@sten.sunnybrook.utoronto.ca
>Release:        version 3.2
>Organization:
>Environment:
Mandrake Linux 9.0
>Description:
Following code fails to compile when trying to pass an integer template parameter to a templated member function.  (This compiles succesfully on MSVC 7)


struct MyStruct
{
	template <int I_>
	int TemplatedMemberFunction()
	{
		return I_;
	}
};

template <int I_>
void TemplatedFunction()
{
	MyStruct ms;
	ms.TemplatedMemberFunction<1>();//doesn't compile.
	ms.TemplatedMemberFunction<I_>();//doesn't compile.
};

int main(int argc , char** argv)
{
	MyStruct ms;
	ms.TemplatedMemberFunction<1>();//compiles.
	TemplatedFunction<1>();			//compiles
	return 0;
}
>How-To-Repeat:
try compiling above code with g++
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="templates.ii"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="templates.ii"

IyAxICJ0ZW1wbGF0ZXMuY2MiCiMgMSAiPGJ1aWx0LWluPiIKIyAxICI8Y29tbWFuZCBsaW5lPiIK
IyAxICJ0ZW1wbGF0ZXMuY2MiCnN0cnVjdCBNeVN0cnVjdAp7CiAgICAgICAgdGVtcGxhdGUgPGlu
dCBJXz4KICAgICAgICBpbnQgVGVtcGxhdGVkTWVtYmVyRnVuY3Rpb24oKQogICAgICAgIHsKICAg
ICAgICAgICAgICAgIHJldHVybiBJXzsKICAgICAgICB9Cn07Cgp0ZW1wbGF0ZSA8aW50IElfPgp2
b2lkIFRlbXBsYXRlZEZ1bmN0aW9uKCkKewogICAgICAgIE15U3RydWN0IG1zOwogICAgICAgIG1z
LlRlbXBsYXRlZE1lbWJlckZ1bmN0aW9uPDE+KCk7CiAgICAgICAgbXMuVGVtcGxhdGVkTWVtYmVy
RnVuY3Rpb248SV8+KCk7Cn07CgppbnQgbWFpbihpbnQgYXJnYyAsIGNoYXIqKiBhcmd2KQp7CiAg
ICAgICAgTXlTdHJ1Y3QgbXM7CiAgICAgICAgbXMuVGVtcGxhdGVkTWVtYmVyRnVuY3Rpb248MT4o
KTsKICAgICAgICBUZW1wbGF0ZWRGdW5jdGlvbjwxPigpOwogICAgICAgIHJldHVybiAwOwp9Cg==


             reply	other threads:[~2003-01-30 17:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-30 17:36 morgan [this message]
2003-02-01 20:42 bangerth
2003-02-02 19:26 Martin Sebor
2003-02-03 20:04 bangerth
2003-02-03 20:08 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=20030130172644.9167.qmail@sources.redhat.com \
    --to=morgan@sten.sunnybrook.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).