This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11993] [3.4 regression] gcc finds passing reference of template argument as template argument invalid
- From: "mark at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Aug 2003 19:17:09 -0000
- Subject: [Bug c++/11993] [3.4 regression] gcc finds passing reference of template argument as template argument invalid
- References: <20030820130921.11993.stefaandr@hotmail.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11993
------- Additional Comments From mark at codesourcery dot com 2003-08-30 19:17 -------
Subject: Re: [3.4 regression] gcc finds passing reference of
template argument as template argument invalid
On Sat, 2003-08-30 at 03:17, stefaandr at hotmail dot com wrote:
> PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11993
>
>
>
> ------- Additional Comments From stefaandr at hotmail dot com 2003-08-30 10:17 -------
> Subject: Re: [3.4 regression] gcc finds passing reference of template arg
>
> >The standard is very clear about what form a non-type template argument may
> >take, and address-of-nontype-template-parameter is not one of the allowed
> >cases.
> The same section you reference to contains:
> A template-argument for a non-type, non-template template-parameter shall be
> one of:
> ...
> - the address of an object or function with external linkage (excluding
> non-static class-members...), expressed as &id-expression...
>
> For clarity, the code in question is the inheritance part: "public class2
> <&a> {};"
> To me, this seems the case above, because I think in the definition of the
> templated class class1, "a" is "the name of an object or function with
> external linkage..." as mentioned in the same paragraph (and I think it must
> be, because you didn't question the definition of class1, and it must comply
> to the same rules in the paragraph). The fact that the name of any
> non-template parameter is also allowed, doesn't contradict this in my
> opinion.
Actually, "a" is the name of a nontype template parameter.
Since the type of that nontype template parameter is a pointer type,
that nontype template parameter must in fact be bound to an object or
function with external linkage. But, the nontype template parameter is
not itself such an object.
That's why I said that this should perhaps be considered a defect in the
standard. I'd suggest raising this on comp.std.c++; if the consensus is
that this is a defect, someone will open a DR. G++ generally implements
corrections for DRs.
Yours,