public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98800] New: ICE on invalid use of non-static member function in trailing return type since r251438
@ 2021-01-22 21:48 ppalka at gcc dot gnu.org
2021-01-22 21:53 ` [Bug c++/98800] [8/9/10/11 Regression] ICE on invalid use of non-static member function in trailing return type since r8-2724 ppalka at gcc dot gnu.org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-01-22 21:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98800
Bug ID: 98800
Summary: ICE on invalid use of non-static member function in
trailing return type since r251438
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ppalka at gcc dot gnu.org
Target Milestone: ---
This invalid testcase is just a minor variant of PR97399#c4 where the member
function is_integral has been made non-static.
$ cat testcase.C
template <bool> struct enable_if_t {};
struct tmp {
template <class> constexpr bool is_integral();
template <class E> static auto func() -> enable_if_t<is_integral<E>()>;
};
template <class> constexpr bool tmp::is_integral() { return true; }
int main() { tmp::func<int>(); }
$ g++ testcase.C
testcase.C: In substitution of ‘template<class T> static
enable_if_t<((tmp*)this)->is_integral<T>()> tmp::f() [with T = int]’:
testcase.C:21:15: required from here
testcase.C:9:39: internal compiler error: in tsubst_copy, at cp/pt.c:16393
9 | -> enable_if_t<tmp::is_integral<T>()>; // { dg-message "in template
argument" }
| ~~~~~~~~~~~~~~~~~~~^~
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/98800] [8/9/10/11 Regression] ICE on invalid use of non-static member function in trailing return type since r8-2724
2021-01-22 21:48 [Bug c++/98800] New: ICE on invalid use of non-static member function in trailing return type since r251438 ppalka at gcc dot gnu.org
@ 2021-01-22 21:53 ` ppalka at gcc dot gnu.org
2021-01-22 21:56 ` ppalka at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-01-22 21:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98800
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|ICE on invalid use of |[8/9/10/11 Regression] ICE
|non-static member function |on invalid use of
|in trailing return type |non-static member function
|since r251438 |in trailing return type
| |since r8-2724
Keywords| |ice-on-invalid-code
CC| |jason at gcc dot gnu.org
Known to fail| |10.2.0, 11.0, 8.4.0, 9.3.0
Known to work| |7.5.0
--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
GCC 7.5 rejects with:
<source>: In function 'int main()':
<source>:7:29: error: no matching function for call to 'tmp::func<int>()'
int main() { tmp::func<int>(); }
^
<source>:4:34: note: candidate: template<class E> static
enable_if_t<is_integral<E>()> tmp::func()
template <class E> static auto func() -> enable_if_t<is_integral<E>()>;
^~~~
<source>:4:34: note: template argument deduction/substitution failed:
<source>: In substitution of 'template<class E> static
enable_if_t<is_integral<E>()> tmp::func() [with E = int]':
<source>:7:29: required from here
<source>:4:70: error: cannot call member function 'constexpr bool
tmp::is_integral() [with <template-parameter-1-1> = int]' without object
template <class E> static auto func() -> enable_if_t<is_integral<E>()>;
~~~~~~~~~~~~~~^~
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/98800] [8/9/10/11 Regression] ICE on invalid use of non-static member function in trailing return type since r8-2724
2021-01-22 21:48 [Bug c++/98800] New: ICE on invalid use of non-static member function in trailing return type since r251438 ppalka at gcc dot gnu.org
2021-01-22 21:53 ` [Bug c++/98800] [8/9/10/11 Regression] ICE on invalid use of non-static member function in trailing return type since r8-2724 ppalka at gcc dot gnu.org
@ 2021-01-22 21:56 ` ppalka at gcc dot gnu.org
2021-01-25 14:49 ` mpolacek at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-01-22 21:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98800
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |8.5
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/98800] [8/9/10/11 Regression] ICE on invalid use of non-static member function in trailing return type since r8-2724
2021-01-22 21:48 [Bug c++/98800] New: ICE on invalid use of non-static member function in trailing return type since r251438 ppalka at gcc dot gnu.org
2021-01-22 21:53 ` [Bug c++/98800] [8/9/10/11 Regression] ICE on invalid use of non-static member function in trailing return type since r8-2724 ppalka at gcc dot gnu.org
2021-01-22 21:56 ` ppalka at gcc dot gnu.org
@ 2021-01-25 14:49 ` mpolacek at gcc dot gnu.org
2021-02-26 12:33 ` rguenth at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-01-25 14:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98800
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-01-25
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
CC| |mpolacek at gcc dot gnu.org
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/98800] [8/9/10/11 Regression] ICE on invalid use of non-static member function in trailing return type since r8-2724
2021-01-22 21:48 [Bug c++/98800] New: ICE on invalid use of non-static member function in trailing return type since r251438 ppalka at gcc dot gnu.org
` (2 preceding siblings ...)
2021-01-25 14:49 ` mpolacek at gcc dot gnu.org
@ 2021-02-26 12:33 ` rguenth at gcc dot gnu.org
2021-04-10 14:42 ` jason at gcc dot gnu.org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-02-26 12:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98800
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/98800] [8/9/10/11 Regression] ICE on invalid use of non-static member function in trailing return type since r8-2724
2021-01-22 21:48 [Bug c++/98800] New: ICE on invalid use of non-static member function in trailing return type since r251438 ppalka at gcc dot gnu.org
` (3 preceding siblings ...)
2021-02-26 12:33 ` rguenth at gcc dot gnu.org
@ 2021-04-10 14:42 ` jason at gcc dot gnu.org
2021-04-10 14:47 ` mpolacek at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2021-04-10 14:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98800
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
I'm getting a correct (if obscure) error message before the ICE:
wa.C:4:71: error: use of ‘this’ in a constant expression
4 | template <class E> static auto func() -> enable_if_t<is_integral<E>()>;
| ^
wa.C:4: confused by earlier errors, bailing out
are you still not?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/98800] [8/9/10/11 Regression] ICE on invalid use of non-static member function in trailing return type since r8-2724
2021-01-22 21:48 [Bug c++/98800] New: ICE on invalid use of non-static member function in trailing return type since r251438 ppalka at gcc dot gnu.org
` (4 preceding siblings ...)
2021-04-10 14:42 ` jason at gcc dot gnu.org
@ 2021-04-10 14:47 ` mpolacek at gcc dot gnu.org
2021-04-10 20:33 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-10 14:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98800
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P2 |P4
Keywords| |error-recovery
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I can see that error message now. So, error-recovery and I suspect P4.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/98800] [8/9/10/11 Regression] ICE on invalid use of non-static member function in trailing return type since r8-2724
2021-01-22 21:48 [Bug c++/98800] New: ICE on invalid use of non-static member function in trailing return type since r251438 ppalka at gcc dot gnu.org
` (5 preceding siblings ...)
2021-04-10 14:47 ` mpolacek at gcc dot gnu.org
@ 2021-04-10 20:33 ` cvs-commit at gcc dot gnu.org
2021-05-14 9:54 ` [Bug c++/98800] [9/10/11/12 " jakub at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-10 20:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98800
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:82198676c80764ca7cf05f891afaee83b9179dd1
commit r11-8118-g82198676c80764ca7cf05f891afaee83b9179dd1
Author: Jason Merrill <jason@redhat.com>
Date: Sat Apr 10 10:55:58 2021 -0400
c++: ICE with invalid use of 'this' with static memfn [PR98800]
Here instantiation of the fake 'this' parameter we used when parsing the
trailing return type of func() was failing because there is no actual
'this'
parameter in the instantiation. For PR97399 I told Patrick to do the
'this'
injection even for statics, but now I think I was wrong; the out-of-class
definition case I was concerned about does not break with this patch. And
we don't set current_class_ptr in the body of a static member function.
And the OMP code should continue to parse 'this' and complain about it
rather than give a syntax error.
gcc/cp/ChangeLog:
PR c++/98800
PR c++/97399
* parser.c (cp_parser_direct_declarator): Don't
inject_this_parameter if static_p.
(cp_parser_omp_var_list_no_open): Parse 'this' even if
current_class_ptr isn't set for a better diagnostic.
gcc/testsuite/ChangeLog:
PR c++/98800
* g++.dg/gomp/this-1.C: Adjust diagnostic.
* g++.dg/cpp0x/constexpr-this1.C: New test.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/98800] [9/10/11/12 Regression] ICE on invalid use of non-static member function in trailing return type since r8-2724
2021-01-22 21:48 [Bug c++/98800] New: ICE on invalid use of non-static member function in trailing return type since r251438 ppalka at gcc dot gnu.org
` (6 preceding siblings ...)
2021-04-10 20:33 ` cvs-commit at gcc dot gnu.org
@ 2021-05-14 9:54 ` jakub at gcc dot gnu.org
2021-06-01 8:19 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-14 9:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98800
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|8.5 |9.4
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 8 branch is being closed.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/98800] [9/10/11/12 Regression] ICE on invalid use of non-static member function in trailing return type since r8-2724
2021-01-22 21:48 [Bug c++/98800] New: ICE on invalid use of non-static member function in trailing return type since r251438 ppalka at gcc dot gnu.org
` (7 preceding siblings ...)
2021-05-14 9:54 ` [Bug c++/98800] [9/10/11/12 " jakub at gcc dot gnu.org
@ 2021-06-01 8:19 ` rguenth at gcc dot gnu.org
2022-05-27 9:44 ` [Bug c++/98800] [10/11/12/13 " rguenth at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01 8:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98800
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|9.4 |9.5
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/98800] [10/11/12/13 Regression] ICE on invalid use of non-static member function in trailing return type since r8-2724
2021-01-22 21:48 [Bug c++/98800] New: ICE on invalid use of non-static member function in trailing return type since r251438 ppalka at gcc dot gnu.org
` (8 preceding siblings ...)
2021-06-01 8:19 ` rguenth at gcc dot gnu.org
@ 2022-05-27 9:44 ` rguenth at gcc dot gnu.org
2022-06-28 10:43 ` jakub at gcc dot gnu.org
2023-07-07 10:38 ` [Bug c++/98800] [11/12/13/14 " rguenth at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27 9:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98800
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|9.5 |10.4
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/98800] [10/11/12/13 Regression] ICE on invalid use of non-static member function in trailing return type since r8-2724
2021-01-22 21:48 [Bug c++/98800] New: ICE on invalid use of non-static member function in trailing return type since r251438 ppalka at gcc dot gnu.org
` (9 preceding siblings ...)
2022-05-27 9:44 ` [Bug c++/98800] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:43 ` jakub at gcc dot gnu.org
2023-07-07 10:38 ` [Bug c++/98800] [11/12/13/14 " rguenth at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98800
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.4 |10.5
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/98800] [11/12/13/14 Regression] ICE on invalid use of non-static member function in trailing return type since r8-2724
2021-01-22 21:48 [Bug c++/98800] New: ICE on invalid use of non-static member function in trailing return type since r251438 ppalka at gcc dot gnu.org
` (10 preceding siblings ...)
2022-06-28 10:43 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:38 ` rguenth at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98800
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.5 |11.5
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2023-07-07 10:38 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-22 21:48 [Bug c++/98800] New: ICE on invalid use of non-static member function in trailing return type since r251438 ppalka at gcc dot gnu.org
2021-01-22 21:53 ` [Bug c++/98800] [8/9/10/11 Regression] ICE on invalid use of non-static member function in trailing return type since r8-2724 ppalka at gcc dot gnu.org
2021-01-22 21:56 ` ppalka at gcc dot gnu.org
2021-01-25 14:49 ` mpolacek at gcc dot gnu.org
2021-02-26 12:33 ` rguenth at gcc dot gnu.org
2021-04-10 14:42 ` jason at gcc dot gnu.org
2021-04-10 14:47 ` mpolacek at gcc dot gnu.org
2021-04-10 20:33 ` cvs-commit at gcc dot gnu.org
2021-05-14 9:54 ` [Bug c++/98800] [9/10/11/12 " jakub at gcc dot gnu.org
2021-06-01 8:19 ` rguenth at gcc dot gnu.org
2022-05-27 9:44 ` [Bug c++/98800] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:43 ` jakub at gcc dot gnu.org
2023-07-07 10:38 ` [Bug c++/98800] [11/12/13/14 " rguenth 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).