public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/10118] [3.3/3.4 Regression] Conversion of ptrmem to derived class in template arg fails
[not found] <20030317033600.10118.philippeb@videotron.ca>
@ 2003-07-17 0:06 ` pinskia at physics dot uc dot edu
2003-09-05 18:44 ` mmitchel at gcc dot gnu dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-17 0:06 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=10118
pinskia at physics dot uc dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Summary|Conversion of ptrmem to |[3.3/3.4 Regression]
|derived class in template |Conversion of ptrmem to
|arg fails |derived class in template
| |arg fails
Target Milestone|--- |3.3.2
------- Additional Comments From pinskia at physics dot uc dot edu 2003-07-17 00:06 -------
2.91.66 accepted this so this is a regression.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/10118] [3.3/3.4 Regression] Conversion of ptrmem to derived class in template arg fails
[not found] <20030317033600.10118.philippeb@videotron.ca>
2003-07-17 0:06 ` [Bug c++/10118] [3.3/3.4 Regression] Conversion of ptrmem to derived class in template arg fails pinskia at physics dot uc dot edu
@ 2003-09-05 18:44 ` mmitchel at gcc dot gnu dot org
2003-09-05 18:49 ` [Bug c++/10118] " bangerth at dealii dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2003-09-05 18:44 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=10118
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|rejects-valid |diagnostic
Target Milestone|3.3.2 |---
------- Additional Comments From mmitchel at gcc dot gnu dot org 2003-09-05 18:44 -------
This code is invalid; the cast may not appear as part of a template argument.
Clearly, the error message (with the brace notation) is sub-optimal.
I've removed the target milestone because I don't know if the error message has
regressed; the audit trail says that most versions of G++ have correctly
rejected this code.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/10118] Conversion of ptrmem to derived class in template arg fails
[not found] <20030317033600.10118.philippeb@videotron.ca>
2003-07-17 0:06 ` [Bug c++/10118] [3.3/3.4 Regression] Conversion of ptrmem to derived class in template arg fails pinskia at physics dot uc dot edu
2003-09-05 18:44 ` mmitchel at gcc dot gnu dot org
@ 2003-09-05 18:49 ` bangerth at dealii dot org
2003-12-05 2:44 ` [Bug c++/10118] Bad diagnostic with cast in template argument expression pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2003-09-05 18:49 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=10118
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[3.3/3.4 Regression] |Conversion of ptrmem to
|Conversion of ptrmem to |derived class in template
|derived class in template |arg fails
|arg fails |
------- Additional Comments From bangerth at dealii dot org 2003-09-05 18:49 -------
Since this is invalid code, it's no longer a regression.
Also, the error message is not a regression. 2.95 gives
g/x> c++ -c x.cc
x.cc:7: `(&A::foo)' is not a valid template argument
x.cc:7: it must be a pointer-to-member of the form `&X::Y'
x.cc:7: ANSI C++ forbids declaration `c' with no type
That's about as bad as what we now get. The message is clearly
suboptimal nevertheless, so let's keep this PR open.
W.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/10118] Bad diagnostic with cast in template argument expression
[not found] <20030317033600.10118.philippeb@videotron.ca>
` (2 preceding siblings ...)
2003-09-05 18:49 ` [Bug c++/10118] " bangerth at dealii dot org
@ 2003-12-05 2:44 ` pinskia at gcc dot gnu dot org
2003-12-05 3:31 ` bangerth at dealii dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-05 2:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-12-05 02:44 -------
this is semi-fixed on the mainline (get rid of the "()" and it would be considered fixed, unless
someone says otherwise. )
pr1011.cc:7: error: `A::foo()' cannot appear in a constant-expression
pr1011.cc:7: error: a casts to a type other than an integral or enumeration type cannot appear in a
constant-expression
pr1011.cc:7: error: template argument 2 is invalid
pr1011.cc:7: error: expected constructor, destructor, or type conversion
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |minor
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10118
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/10118] Bad diagnostic with cast in template argument expression
[not found] <20030317033600.10118.philippeb@videotron.ca>
` (3 preceding siblings ...)
2003-12-05 2:44 ` [Bug c++/10118] Bad diagnostic with cast in template argument expression pinskia at gcc dot gnu dot org
@ 2003-12-05 3:31 ` bangerth at dealii dot org
2004-08-20 6:52 ` pinskia at gcc dot gnu dot org
2004-08-20 7:12 ` gdr at integrable-solutions dot net
6 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2003-12-05 3:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2003-12-05 03:31 -------
I see two open issues here: first, the error message has wrong
grammar ("a cast_s_").
The second thing is that what is being attempted here doesn't seem
to be possible: neither of these work:
CT<B, &A::foo> c1;
CT<B, &B::foo> c2;
CT<B, (B_ptr)&B::foo> c3;
The second one is particularly confusing, since &B::foo immediately decays
to A::*, but this has recently been discussed in another PR and seems to
be standards conforming. The last one should cast this back, but this
isn't allowed. The first one should of course be wrong. So we are left
with a situation where something just can't be done. Someone should
file a DR for this, this is clearly a less than satisfactory situation...
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10118
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/10118] Bad diagnostic with cast in template argument expression
[not found] <20030317033600.10118.philippeb@videotron.ca>
` (4 preceding siblings ...)
2003-12-05 3:31 ` bangerth at dealii dot org
@ 2004-08-20 6:52 ` pinskia at gcc dot gnu dot org
2004-08-20 7:12 ` gdr at integrable-solutions dot net
6 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-20 6:52 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-08-20 06:52 -------
Slightly error message change:
pr10118.cc:8: error: `A::foo()' cannot appear in a constant-expression
pr10118.cc:8: error: `&' cannot appear in a constant-expression
pr10118.cc:8: error: a cast to a type other than an integral or enumeration type cannot appear in a
constant-expression
pr10118.cc:8: error: template argument 2 is invalid
pr10118.cc:8: error: invalid type in declaration before ';' token
--
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2004-05-21 03:50:25 |2004-08-20 06:52:50
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10118
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/10118] Bad diagnostic with cast in template argument expression
[not found] <20030317033600.10118.philippeb@videotron.ca>
` (5 preceding siblings ...)
2004-08-20 6:52 ` pinskia at gcc dot gnu dot org
@ 2004-08-20 7:12 ` gdr at integrable-solutions dot net
6 siblings, 0 replies; 9+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-08-20 7:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at integrable-solutions dot net 2004-08-20 07:12 -------
Subject: Re: Bad diagnostic with cast in template argument expression
"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| Slightly error message change:
| pr10118.cc:8: error: `A::foo()' cannot appear in a constant-expression
This is wrong and I know why. The code cp/error.c is too contrived to
fix it properly. It is better to rely on the code in
cp/cxx-pretty-print.c to fix it.
| pr10118.cc:8: error: `&' cannot appear in a constant-expression
This does nto make any sense.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10118
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/10118] Bad diagnostic with cast in template argument expression
[not found] <bug-10118-4@http.gcc.gnu.org/bugzilla/>
2021-07-23 19:49 ` pinskia at gcc dot gnu.org
@ 2024-04-04 0:08 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-04 0:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10118
--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, clang accepts this also for -std=c++17 (and above).
While EDG accepts this for --c++11 (and above).
Is this valid in C++11+ or C++17+ now?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/10118] Bad diagnostic with cast in template argument expression
[not found] <bug-10118-4@http.gcc.gnu.org/bugzilla/>
@ 2021-07-23 19:49 ` pinskia at gcc dot gnu.org
2024-04-04 0:08 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-23 19:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10118
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Blocks| |101603
Last reconfirmed|2005-12-11 23:07:23 |2021-7-23
--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
We get now:
<source>:7:26: error: 'void (B::*)(){((void (B::*)())A::foo), 0}' is not a
valid template argument for type 'void (B::*)()'
7 | CT<B, (B_ptr) &A::foo> c;
| ^
<source>:7:26: note: it must be a pointer-to-member of the form '&X::Y'
ASM generation compiler returned: 1
<source>:7:26: error: 'void (B::*)(){((void (B::*)())A::foo), 0}' is not a
valid template argument for type 'void (B::*)()'
7 | CT<B, (B_ptr) &A::foo> c;
| ^
<source>:7:26: note: it must be a pointer-to-member of the form '&X::Y'
Execution build compiler returned: 1
While clang produces:
<source>:7:11: error: non-type template argument is not a pointer to member
constant
CT<B, (B_ptr) &A::foo> c;
^~~~~~~~~~~~~~~
1 error generated.
ASM generation compiler returned: 1
<source>:7:11: error: non-type template argument is not a pointer to member
constant
CT<B, (B_ptr) &A::foo> c;
^~~~~~~~~~~~~~~
Both are not obvious but gcc is still worse as it has the "{((void
(B::*)())A::foo), 0}" part there still.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101603
[Bug 101603] [meta-bug] pointer to member functions issues
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-04-04 0:08 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20030317033600.10118.philippeb@videotron.ca>
2003-07-17 0:06 ` [Bug c++/10118] [3.3/3.4 Regression] Conversion of ptrmem to derived class in template arg fails pinskia at physics dot uc dot edu
2003-09-05 18:44 ` mmitchel at gcc dot gnu dot org
2003-09-05 18:49 ` [Bug c++/10118] " bangerth at dealii dot org
2003-12-05 2:44 ` [Bug c++/10118] Bad diagnostic with cast in template argument expression pinskia at gcc dot gnu dot org
2003-12-05 3:31 ` bangerth at dealii dot org
2004-08-20 6:52 ` pinskia at gcc dot gnu dot org
2004-08-20 7:12 ` gdr at integrable-solutions dot net
[not found] <bug-10118-4@http.gcc.gnu.org/bugzilla/>
2021-07-23 19:49 ` pinskia at gcc dot gnu.org
2024-04-04 0:08 ` pinskia at gcc dot gnu.org
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).