public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115364] New: ICE-on-invalid when calling non-const template member on const object
@ 2024-06-05 18:16 blubban at gmail dot com
  2024-06-05 18:39 ` [Bug c++/115364] [11/12/13/14/15 Regression] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: blubban at gmail dot com @ 2024-06-05 18:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115364

            Bug ID: 115364
           Summary: ICE-on-invalid when calling non-const template member
                    on const object
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: blubban at gmail dot com
  Target Milestone: ---

struct foo
{
    template<int> void not_const() {}
};
void fn(const foo& obj) { obj.not_const<5>(); }


No flags needed.


<source>: In member function 'void foo::fn() const':
<source>:4:41: error: cannot convert 'const foo*' to 'foo*'
    4 |     void fn() const { this->not_const<5>(); }
      |                       ~~~~~~~~~~~~~~~~~~^~
<source>:4:41: internal compiler error: tree check: expected function_decl,
have template_decl in get_fndecl_argument_location, at cp/call.cc:8354
0x26aa1ac internal_error(char const*, ...)
        ???:0
0x96fd9e tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ???:0
0xa7d15f complain_about_bad_argument(unsigned int, tree_node*, tree_node*,
tree_node*, int)
        ???:0
0xa8c20a build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        ???:0
0xce8267 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ???:0
0xc6a70a c_parse_file()
        ???:0
0xdbfcf9 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1


Online reproducer: https://godbolt.org/z/86noE3935


I would've expected something as simple as this to have been tested and fixed
long ago, but apparently not. Probably because it's just a tree check; from
what I've heard, they don't exist in versioned releases of GCC.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/115364] [11/12/13/14/15 Regression] ICE-on-invalid when calling non-const template member on const object
  2024-06-05 18:16 [Bug c++/115364] New: ICE-on-invalid when calling non-const template member on const object blubban at gmail dot com
@ 2024-06-05 18:39 ` pinskia at gcc dot gnu.org
  2024-06-06  6:48 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-05 18:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115364

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.5
            Summary|ICE-on-invalid when calling |[11/12/13/14/15 Regression]
                   |non-const template member   |ICE-on-invalid when calling
                   |on const object             |non-const template member
                   |                            |on const object
   Last reconfirmed|                            |2024-06-05
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |diagnostic, error-recovery,
                   |                            |ice-checking

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>Probably because it's just a tree check; from what I've heard, they 

Yes it does not show up with release checking set so most folks won't see the
ICE in this case and it is only trying to find the location of the argument
which in this case it is this which does not really have a location.

Anyways confirmed, 99% sure it was introduced by r8-3378-g9003adc732305c .

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/115364] [11/12/13/14/15 Regression] ICE-on-invalid when calling non-const template member on const object
  2024-06-05 18:16 [Bug c++/115364] New: ICE-on-invalid when calling non-const template member on const object blubban at gmail dot com
  2024-06-05 18:39 ` [Bug c++/115364] [11/12/13/14/15 Regression] " pinskia at gcc dot gnu.org
@ 2024-06-06  6:48 ` rguenth at gcc dot gnu.org
  2024-06-27 14:34 ` simartin at gcc dot gnu.org
  2024-06-28 21:33 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-06-06  6:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115364

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/115364] [11/12/13/14/15 Regression] ICE-on-invalid when calling non-const template member on const object
  2024-06-05 18:16 [Bug c++/115364] New: ICE-on-invalid when calling non-const template member on const object blubban at gmail dot com
  2024-06-05 18:39 ` [Bug c++/115364] [11/12/13/14/15 Regression] " pinskia at gcc dot gnu.org
  2024-06-06  6:48 ` rguenth at gcc dot gnu.org
@ 2024-06-27 14:34 ` simartin at gcc dot gnu.org
  2024-06-28 21:33 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: simartin at gcc dot gnu.org @ 2024-06-27 14:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115364

Simon Martin <simartin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |simartin at gcc dot gnu.org

--- Comment #2 from Simon Martin <simartin at gcc dot gnu.org> ---
Working on it.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/115364] [11/12/13/14/15 Regression] ICE-on-invalid when calling non-const template member on const object
  2024-06-05 18:16 [Bug c++/115364] New: ICE-on-invalid when calling non-const template member on const object blubban at gmail dot com
                   ` (2 preceding siblings ...)
  2024-06-27 14:34 ` simartin at gcc dot gnu.org
@ 2024-06-28 21:33 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-06-28 21:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115364

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org
         Resolution|---                         |DUPLICATE
             Status|ASSIGNED                    |RESOLVED

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Started with r12-3346.. looks like this is basically a dup of PR106760.

*** This bug has been marked as a duplicate of bug 106760 ***

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-06-28 21:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-05 18:16 [Bug c++/115364] New: ICE-on-invalid when calling non-const template member on const object blubban at gmail dot com
2024-06-05 18:39 ` [Bug c++/115364] [11/12/13/14/15 Regression] " pinskia at gcc dot gnu.org
2024-06-06  6:48 ` rguenth at gcc dot gnu.org
2024-06-27 14:34 ` simartin at gcc dot gnu.org
2024-06-28 21:33 ` ppalka 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).