public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11993] New: gcc finds passing reference of template argument as template argument invalid
@ 2003-08-20 13:09 stefaandr at hotmail dot com
2003-08-20 14:36 ` [Bug c++/11993] " bangerth at dealii dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: stefaandr at hotmail dot com @ 2003-08-20 13:09 UTC (permalink / raw)
To: gcc-bugs
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
Summary: gcc finds passing reference of template argument as
template argument invalid
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: stefaandr at hotmail dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
this code doesn't compile anymore on 3.4, it does on 3.3.1 and before (but I
have no idea if this is a valid or invalid decision or 3.4)
Reading specs from /esat/quendi/gcc/lib/gcc/i686-pc-linux-gnu/3.4/specs
Configured with: ../../gcc/3.4/configure --program-suffix=-3.4
--enable-languages=c,c++ --prefix=/esat/quendi/gcc : (reconfigured)
Thread model: posix
gcc version 3.4 20030820 (experimental)
/esat/quendi/gcc/libexec/gcc/i686-pc-linux-gnu/3.4/cc1plus -E -quiet -v
-D_GNU_SOURCE /tmp/test5.cpp -mtune=pentiumpro -o test5.ii
ignoring nonexistent directory
"/esat/quendi/gcc/lib/gcc/i686-pc-linux-gnu/3.4/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/esat/quendi/gcc/lib/gcc/i686-pc-linux-gnu/3.4/../../../../include/c++/3.4
/esat/quendi/gcc/lib/gcc/i686-pc-linux-gnu/3.4/../../../../include/c++/3.4/i686-pc-linux-gnu
/esat/quendi/gcc/lib/gcc/i686-pc-linux-gnu/3.4/../../../../include/c++/3.4/backward
/usr/local/include
/esat/quendi/gcc/include
/esat/quendi/gcc/lib/gcc/i686-pc-linux-gnu/3.4/include
/usr/include
End of search list.
/esat/quendi/gcc/libexec/gcc/i686-pc-linux-gnu/3.4/cc1plus -fpreprocessed
test5.ii -quiet -dumpbase test5.cpp -mtune=pentiumpro -auxbase-strip
/tmp/test5.o -version -o test5.s
GNU C++ version 3.4 20030820 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 3.3.1.
GGC heuristics: --param ggc-min-expand=55 --param ggc-min-heapsize=48056
/tmp/test5.cpp:2: error: template argument 1 is invalid
/tmp/test5.cpp:2: error: expected `{'
/tmp/test5.cpp:2: error: expected init-declarator
/tmp/test5.cpp:2: error: expected `;'
test5.ii:
# 1 "/tmp/test5.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "/tmp/test5.cpp"
template <int * a> class class2 {};
template <int & a> class class1 : public class2 <&a> {};
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/11993] gcc finds passing reference of template argument as template argument invalid
2003-08-20 13:09 [Bug c++/11993] New: gcc finds passing reference of template argument as template argument invalid stefaandr at hotmail dot com
@ 2003-08-20 14:36 ` bangerth at dealii dot org
2003-08-20 14:42 ` [Bug c++/11993] [3.4 regression] " pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2003-08-20 14:36 UTC (permalink / raw)
To: gcc-bugs
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
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-08-20 14:36:07
date| |
------- Additional Comments From bangerth at dealii dot org 2003-08-20 14:36 -------
Confirmed. I tend to think that it might somehow be related to PR 11847.
W.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/11993] [3.4 regression] gcc finds passing reference of template argument as template argument invalid
2003-08-20 13:09 [Bug c++/11993] New: gcc finds passing reference of template argument as template argument invalid stefaandr at hotmail dot com
2003-08-20 14:36 ` [Bug c++/11993] " bangerth at dealii dot org
@ 2003-08-20 14:42 ` pinskia at gcc dot gnu dot org
2003-08-23 3:14 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-20 14:42 UTC (permalink / raw)
To: gcc-bugs
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
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-08-20 14:42 -------
Even more evidence that this is related to bug 11847, the same date from the Phil's regression
hunter: Search converges between 2003-07-08-trunk (#337) and 2003-07-09-trunk (#338).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/11993] [3.4 regression] gcc finds passing reference of template argument as template argument invalid
2003-08-20 13:09 [Bug c++/11993] New: gcc finds passing reference of template argument as template argument invalid stefaandr at hotmail dot com
2003-08-20 14:36 ` [Bug c++/11993] " bangerth at dealii dot org
2003-08-20 14:42 ` [Bug c++/11993] [3.4 regression] " pinskia at gcc dot gnu dot org
@ 2003-08-23 3:14 ` pinskia at gcc dot gnu dot org
2003-08-29 20:17 ` janis187 at us dot ibm dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-23 3:14 UTC (permalink / raw)
To: gcc-bugs
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
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Severity|normal |critical
Priority|P2 |P1
Last reconfirmed|2003-08-20 14:36:07 |2003-08-23 03:14:33
date| |
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/11993] [3.4 regression] gcc finds passing reference of template argument as template argument invalid
2003-08-20 13:09 [Bug c++/11993] New: gcc finds passing reference of template argument as template argument invalid stefaandr at hotmail dot com
` (2 preceding siblings ...)
2003-08-23 3:14 ` pinskia at gcc dot gnu dot org
@ 2003-08-29 20:17 ` janis187 at us dot ibm dot com
2003-08-30 0:34 ` mmitchel at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: janis187 at us dot ibm dot com @ 2003-08-29 20:17 UTC (permalink / raw)
To: gcc-bugs
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
janis187 at us dot ibm dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mmitchel at gcc dot gnu dot
| |org
------- Additional Comments From janis187 at us dot ibm dot com 2003-08-29 20:17 -------
The regression in PR 11993 was introduced or exposed by this patch
(not the same one that introduced or exposed PR 11847, which was added
a few hours earlier):
--- gcc/gcc/ChangeLog ---
2003-07-08 Mark Mitchell <mark@codesourcery.com>
* fold-const.c (make_range): Do not access operand 1 for a
zero-operand operator.
--- gcc/gcc/cp/ChangeLog ---
2003-07-08 Mark Mitchell <mark@codesourcery.com>
* cp-tree.def (NON_DEPENDENT_EXPR): New node.
* cp-tree.h (build_call_from_tree): Remove.
(build_member_call): Likewise.
(dependent_template_arg_p): Remove.
[lots more]
The regression hunt took place on i686-pc-linux-gnu using the submitter's
test case.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/11993] [3.4 regression] gcc finds passing reference of template argument as template argument invalid
2003-08-20 13:09 [Bug c++/11993] New: gcc finds passing reference of template argument as template argument invalid stefaandr at hotmail dot com
` (3 preceding siblings ...)
2003-08-29 20:17 ` janis187 at us dot ibm dot com
@ 2003-08-30 0:34 ` mmitchel at gcc dot gnu dot org
2003-08-30 10:17 ` stefaandr at hotmail dot com
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2003-08-30 0:34 UTC (permalink / raw)
To: gcc-bugs
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
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
------- Additional Comments From mmitchel at gcc dot gnu dot org 2003-08-30 00:34 -------
This code is invalid.
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.
See [temp.arg.nontype].
Arguably, this is a defect, but there has been no DR filed with the committee
about this issue.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/11993] [3.4 regression] gcc finds passing reference of template argument as template argument invalid
2003-08-20 13:09 [Bug c++/11993] New: gcc finds passing reference of template argument as template argument invalid stefaandr at hotmail dot com
` (4 preceding siblings ...)
2003-08-30 0:34 ` mmitchel at gcc dot gnu dot org
@ 2003-08-30 10:17 ` stefaandr at hotmail dot com
2003-08-30 19:17 ` mark at codesourcery dot com
2003-09-11 22:36 ` stefaandr at hotmail dot com
7 siblings, 0 replies; 9+ messages in thread
From: stefaandr at hotmail dot com @ 2003-08-30 10:17 UTC (permalink / raw)
To: gcc-bugs
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.
_________________________________________________________________
MSN 8: Get 6 months for $9.95/month. http://join.msn.com/?page=dept/dialup
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/11993] [3.4 regression] gcc finds passing reference of template argument as template argument invalid
2003-08-20 13:09 [Bug c++/11993] New: gcc finds passing reference of template argument as template argument invalid stefaandr at hotmail dot com
` (5 preceding siblings ...)
2003-08-30 10:17 ` stefaandr at hotmail dot com
@ 2003-08-30 19:17 ` mark at codesourcery dot com
2003-09-11 22:36 ` stefaandr at hotmail dot com
7 siblings, 0 replies; 9+ messages in thread
From: mark at codesourcery dot com @ 2003-08-30 19:17 UTC (permalink / raw)
To: gcc-bugs
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,
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/11993] [3.4 regression] gcc finds passing reference of template argument as template argument invalid
2003-08-20 13:09 [Bug c++/11993] New: gcc finds passing reference of template argument as template argument invalid stefaandr at hotmail dot com
` (6 preceding siblings ...)
2003-08-30 19:17 ` mark at codesourcery dot com
@ 2003-09-11 22:36 ` stefaandr at hotmail dot com
7 siblings, 0 replies; 9+ messages in thread
From: stefaandr at hotmail dot com @ 2003-09-11 22:36 UTC (permalink / raw)
To: gcc-bugs
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-09-11 22:36 -------
As suggested, I have posted a message on comp.std.c++ to address this
possibility of a defect in the standard.
Newsgroups: comp.std.c++
Subject: Passing the address of a non-type template parameter
Date: Mon, 8 Sep 2003 08:28:42 +0000 (UTC)
Message-ID: <1062669363.819321@seven.kulnet.kuleuven.ac.be>
X-Trace: mail2news.demon.co.uk 1063009722 11190 10.0.0.1 (8 Sep 2003 08:28:42 GMT)
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2003-09-11 22:36 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-20 13:09 [Bug c++/11993] New: gcc finds passing reference of template argument as template argument invalid stefaandr at hotmail dot com
2003-08-20 14:36 ` [Bug c++/11993] " bangerth at dealii dot org
2003-08-20 14:42 ` [Bug c++/11993] [3.4 regression] " pinskia at gcc dot gnu dot org
2003-08-23 3:14 ` pinskia at gcc dot gnu dot org
2003-08-29 20:17 ` janis187 at us dot ibm dot com
2003-08-30 0:34 ` mmitchel at gcc dot gnu dot org
2003-08-30 10:17 ` stefaandr at hotmail dot com
2003-08-30 19:17 ` mark at codesourcery dot com
2003-09-11 22:36 ` stefaandr at hotmail dot com
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).