public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100649] New: ICE in coerce_template_parms (releases) or cxx_eval_constant_expression (trunk)
@ 2021-05-18 11:52 ebotcazou at gcc dot gnu.org
  2021-05-18 14:48 ` [Bug c++/100649] [9/10/11/12 Regression] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-05-18 11:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100649
           Summary: ICE in coerce_template_parms (releases) or
                    cxx_eval_constant_expression (trunk)
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ebotcazou at gcc dot gnu.org
  Target Milestone: ---

The compiler ICEs either in coerce_template_parms for releases:

t.cpp: In member function 'void B<T>::foo(const A<32>&)':
t.cpp:12:24: internal compiler error: in coerce_template_parms, at cp/pt.c:9082
   12 |       A<2 + mesg.size()> local_mesg;
      |                        ^
0x6267e6 coerce_template_parms
        /home/eric/cvs/gcc-11/gcc/cp/pt.c:9082

or in cxx_eval_constant_expression on the trunk:

t.cpp: In member function 'void B<T>::foo(const A<32>&)':
t.cpp:12:24: internal compiler error: in cxx_eval_constant_expression, at
cp/constexpr.c:6622
   12 |       A<2 + mesg.size()> local_mesg;
      |                        ^
0x651967 cxx_eval_constant_expression
        /home/eric/cvs/gcc/gcc/cp/constexpr.c:6622

for the following testcase:

template <int N>
struct A
{
  constexpr int size () const { return N; }
};

template <class T>
struct B
{
   void foo (const A<32> &mesg)
   {
      A<2 + mesg.size()> local_mesg;
   }
};

The code is correctly rejected when the 2nd template declaration is removed:

t.cpp: In member function 'void B::foo(const A<32>&)':
t.cpp:12:24: error: 'mesg' is not a constant expression
   12 |       A<2 + mesg.size()> local_mesg;
      |                        ^
t.cpp:12:11: note: in template argument for type 'int'
   12 |       A<2 + mesg.size()> local_mesg;
      |         ~~^~~~~~~~~~~~~

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

* [Bug c++/100649] [9/10/11/12 Regression] ICE in coerce_template_parms (releases) or cxx_eval_constant_expression (trunk)
  2021-05-18 11:52 [Bug c++/100649] New: ICE in coerce_template_parms (releases) or cxx_eval_constant_expression (trunk) ebotcazou at gcc dot gnu.org
@ 2021-05-18 14:48 ` mpolacek at gcc dot gnu.org
  2021-05-18 14:52 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-05-18 14:48 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.4
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1
           Keywords|                            |ice-on-invalid-code
   Last reconfirmed|                            |2021-05-18
            Summary|ICE in                      |[9/10/11/12 Regression] ICE
                   |coerce_template_parms       |in coerce_template_parms
                   |(releases) or               |(releases) or
                   |cxx_eval_constant_expressio |cxx_eval_constant_expressio
                   |n (trunk)                   |n (trunk)
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.  Compiled without errors with GCC 7.

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

* [Bug c++/100649] [9/10/11/12 Regression] ICE in coerce_template_parms (releases) or cxx_eval_constant_expression (trunk)
  2021-05-18 11:52 [Bug c++/100649] New: ICE in coerce_template_parms (releases) or cxx_eval_constant_expression (trunk) ebotcazou at gcc dot gnu.org
  2021-05-18 14:48 ` [Bug c++/100649] [9/10/11/12 Regression] " mpolacek at gcc dot gnu.org
@ 2021-05-18 14:52 ` mpolacek at gcc dot gnu.org
  2021-05-18 14:52 ` mpolacek at gcc dot gnu.org
  2021-05-18 15:13 ` ebotcazou at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-05-18 14:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The ICE appeared with r251423.

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

* [Bug c++/100649] [9/10/11/12 Regression] ICE in coerce_template_parms (releases) or cxx_eval_constant_expression (trunk)
  2021-05-18 11:52 [Bug c++/100649] New: ICE in coerce_template_parms (releases) or cxx_eval_constant_expression (trunk) ebotcazou at gcc dot gnu.org
  2021-05-18 14:48 ` [Bug c++/100649] [9/10/11/12 Regression] " mpolacek at gcc dot gnu.org
  2021-05-18 14:52 ` mpolacek at gcc dot gnu.org
@ 2021-05-18 14:52 ` mpolacek at gcc dot gnu.org
  2021-05-18 15:13 ` ebotcazou at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-05-18 14:52 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Oh, it's a dup.

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

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

* [Bug c++/100649] [9/10/11/12 Regression] ICE in coerce_template_parms (releases) or cxx_eval_constant_expression (trunk)
  2021-05-18 11:52 [Bug c++/100649] New: ICE in coerce_template_parms (releases) or cxx_eval_constant_expression (trunk) ebotcazou at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-05-18 14:52 ` mpolacek at gcc dot gnu.org
@ 2021-05-18 15:13 ` ebotcazou at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-05-18 15:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> Confirmed.  Compiled without errors with GCC 7.

The error is properly issued in C++11 mode (-std=c++11):

t.cpp: In member function 'void B<T>::foo(const A<32>&)':
t.cpp:12:23: error: 'mesg' is not a constant expression
   12 |       A<2 + mesg.size()> local_mesg;
      |                       ^

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

end of thread, other threads:[~2021-05-18 15:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 11:52 [Bug c++/100649] New: ICE in coerce_template_parms (releases) or cxx_eval_constant_expression (trunk) ebotcazou at gcc dot gnu.org
2021-05-18 14:48 ` [Bug c++/100649] [9/10/11/12 Regression] " mpolacek at gcc dot gnu.org
2021-05-18 14:52 ` mpolacek at gcc dot gnu.org
2021-05-18 14:52 ` mpolacek at gcc dot gnu.org
2021-05-18 15:13 ` ebotcazou 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).