public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110031] New: ICE: error reporting routines re-entered on non-type template argument
@ 2023-05-29 22:45 stevenxia990430 at gmail dot com
  2023-05-30  3:41 ` [Bug c++/110031] " pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: stevenxia990430 at gmail dot com @ 2023-05-29 22:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110031
           Summary: ICE: error reporting routines re-entered on non-type
                    template argument
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stevenxia990430 at gmail dot com
  Target Milestone: ---

The following program produces internal compiler error: error reporting
routines re-entered. Checked on clang and it was rejected as invalid code.
Tested on gcc trunk. 


To quickly reproduce: https://gcc.godbolt.org/z/ex14EKeox
```
#include <type_traits>

#include <iostream>
template <typename T>
constexpr void print_type()
{
  std::cout << "Type: " << typeid(T).name();
}
template <typename T, std::enable_if_t<std::is_literal_type_v<std::decay_t<T>>,
int> = 0>
struct A {
  A(T &&)
  {
  }
};

template <typename T>
struct A<T> {
  A(T &&) = delete;
};

int main(void)
{
  A a{5.3};
  return 0;
}
```

Note, if we comment out the A a{5.3}; line in main function, gcc-trunk actually
accept this code (compiles) however it is rejected by clang. Might be related
to  this: bug109390

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

* [Bug c++/110031] ICE: error reporting routines re-entered on non-type template argument
  2023-05-29 22:45 [Bug c++/110031] New: ICE: error reporting routines re-entered on non-type template argument stevenxia990430 at gmail dot com
@ 2023-05-30  3:41 ` pinskia at gcc dot gnu.org
  2023-05-30  3:49 ` [Bug c++/110031] [10/11/12/13/14 Regression] ICE with deprecated attribute and NTTP and diagnostic for deprecated printed out so much pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-30  3:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Self-contained testcase without any headers:
```
template <typename T>
[[deprecated]] 
inline constexpr bool t = true ;

template <bool a>
struct enableif;

template<>
struct enableif<true>
{
        using y = int;
};
template <bool a>
using enableif_t = enableif<a>::y;

template <typename T, enableif_t<t<T>> = 0>
struct A {  A(T &&)  {  }};

template <typename T>
struct A<T> {
  A(T &&) = delete;
};

int main(void)
{
  A<double> a{5.3};
  return 0;
}
```

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

* [Bug c++/110031] [10/11/12/13/14 Regression] ICE with deprecated attribute and NTTP and diagnostic for deprecated printed out so much
  2023-05-29 22:45 [Bug c++/110031] New: ICE: error reporting routines re-entered on non-type template argument stevenxia990430 at gmail dot com
  2023-05-30  3:41 ` [Bug c++/110031] " pinskia at gcc dot gnu.org
@ 2023-05-30  3:49 ` pinskia at gcc dot gnu.org
  2023-05-30  4:31 ` stevenxia990430 at gmail dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-30  3:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Target Milestone|---                         |10.5
   Last reconfirmed|                            |2023-05-30
      Known to work|                            |7.1.0
            Summary|ICE: error reporting        |[10/11/12/13/14 Regression]
                   |routines re-entered on      |ICE with deprecated
                   |non-type template argument  |attribute and NTTP and
                   |and C++20+                  |diagnostic for deprecated
                   |                            |printed out so much
           Keywords|                            |diagnostic, ice-checking
             Status|UNCONFIRMED                 |NEW
      Known to fail|                            |8.1.0

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Better testcase which fails with -std=c++17 even earlier than GCC 8.
```
template <typename T>
[[deprecated]] 
inline constexpr bool t = true ;

template <bool a>
struct enableif;

template<>
struct enableif<true>
{
        using y = int;
};
template <bool a>
using enableif_t = typename enableif<a>::y;

template <typename T, enableif_t<t<T>> = 0>
struct A {  A(T &&)  {  }};

template <typename T>
struct A<T> {
  A(T &&) = delete;
  A() = delete;
};

int main(void)
{
  A<double> a(5.3);
  return 0;
}
```

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

* [Bug c++/110031] [10/11/12/13/14 Regression] ICE with deprecated attribute and NTTP and diagnostic for deprecated printed out so much
  2023-05-29 22:45 [Bug c++/110031] New: ICE: error reporting routines re-entered on non-type template argument stevenxia990430 at gmail dot com
  2023-05-30  3:41 ` [Bug c++/110031] " pinskia at gcc dot gnu.org
  2023-05-30  3:49 ` [Bug c++/110031] [10/11/12/13/14 Regression] ICE with deprecated attribute and NTTP and diagnostic for deprecated printed out so much pinskia at gcc dot gnu.org
@ 2023-05-30  4:31 ` stevenxia990430 at gmail dot com
  2023-07-07 10:45 ` [Bug c++/110031] [11/12/13/14 " rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: stevenxia990430 at gmail dot com @ 2023-05-30  4:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Steven Xia <stevenxia990430 at gmail dot com> ---
Thanks for the improved testcase.

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

* [Bug c++/110031] [11/12/13/14 Regression] ICE with deprecated attribute and NTTP and diagnostic for deprecated printed out so much
  2023-05-29 22:45 [Bug c++/110031] New: ICE: error reporting routines re-entered on non-type template argument stevenxia990430 at gmail dot com
                   ` (2 preceding siblings ...)
  2023-05-30  4:31 ` stevenxia990430 at gmail dot com
@ 2023-07-07 10:45 ` rguenth at gcc dot gnu.org
  2024-01-12 13:57 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

* [Bug c++/110031] [11/12/13/14 Regression] ICE with deprecated attribute and NTTP and diagnostic for deprecated printed out so much
  2023-05-29 22:45 [Bug c++/110031] New: ICE: error reporting routines re-entered on non-type template argument stevenxia990430 at gmail dot com
                   ` (3 preceding siblings ...)
  2023-07-07 10:45 ` [Bug c++/110031] [11/12/13/14 " rguenth at gcc dot gnu.org
@ 2024-01-12 13:57 ` rguenth at gcc dot gnu.org
  2024-01-12 13:58 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-12 13:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
           Keywords|                            |ice-on-invalid-code

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

* [Bug c++/110031] [11/12/13/14 Regression] ICE with deprecated attribute and NTTP and diagnostic for deprecated printed out so much
  2023-05-29 22:45 [Bug c++/110031] New: ICE: error reporting routines re-entered on non-type template argument stevenxia990430 at gmail dot com
                   ` (4 preceding siblings ...)
  2024-01-12 13:57 ` rguenth at gcc dot gnu.org
@ 2024-01-12 13:58 ` rguenth at gcc dot gnu.org
  2024-03-04 17:10 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-12 13:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P4                          |P2
           Keywords|                            |accepts-invalid

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

* [Bug c++/110031] [11/12/13/14 Regression] ICE with deprecated attribute and NTTP and diagnostic for deprecated printed out so much
  2023-05-29 22:45 [Bug c++/110031] New: ICE: error reporting routines re-entered on non-type template argument stevenxia990430 at gmail dot com
                   ` (5 preceding siblings ...)
  2024-01-12 13:58 ` rguenth at gcc dot gnu.org
@ 2024-03-04 17:10 ` mpolacek at gcc dot gnu.org
  2024-03-04 17:15 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-03-04 17:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r8-4678-g6296cf8e099aae:

commit 6296cf8e099aae43c86a773f93d83a19df85d7e7
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Nov 16 15:13:48 2017 -0500

    PR c++/79092 - non-type args of different types are different

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

* [Bug c++/110031] [11/12/13/14 Regression] ICE with deprecated attribute and NTTP and diagnostic for deprecated printed out so much
  2023-05-29 22:45 [Bug c++/110031] New: ICE: error reporting routines re-entered on non-type template argument stevenxia990430 at gmail dot com
                   ` (6 preceding siblings ...)
  2024-03-04 17:10 ` mpolacek at gcc dot gnu.org
@ 2024-03-04 17:15 ` mpolacek at gcc dot gnu.org
  2024-03-07 15:01 ` cvs-commit at gcc dot gnu.org
  2024-03-07 15:02 ` [Bug c++/110031] [11/12/13 " mpolacek at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-03-04 17:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/110031] [11/12/13/14 Regression] ICE with deprecated attribute and NTTP and diagnostic for deprecated printed out so much
  2023-05-29 22:45 [Bug c++/110031] New: ICE: error reporting routines re-entered on non-type template argument stevenxia990430 at gmail dot com
                   ` (7 preceding siblings ...)
  2024-03-04 17:15 ` mpolacek at gcc dot gnu.org
@ 2024-03-07 15:01 ` cvs-commit at gcc dot gnu.org
  2024-03-07 15:02 ` [Bug c++/110031] [11/12/13 " mpolacek at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-07 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:9f915684624413f96e1a5ffada398ccd1c533e38

commit r14-9364-g9f915684624413f96e1a5ffada398ccd1c533e38
Author: Marek Polacek <polacek@redhat.com>
Date:   Mon Mar 4 12:35:18 2024 -0500

    c++: ICE with variable template and [[deprecated]] [PR110031]

    lookup_and_finish_template_variable already has and uses the complain
    parameter but it is not passing it down to mark_used so we got the
    default tf_warning_or_error, which causes various problems when
    lookup_and_finish_template_variable gets called with complain=tf_none.

            PR c++/110031

    gcc/cp/ChangeLog:

            * pt.cc (lookup_and_finish_template_variable): Pass complain to
            mark_used.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1z/inline-var11.C: New test.

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

* [Bug c++/110031] [11/12/13 Regression] ICE with deprecated attribute and NTTP and diagnostic for deprecated printed out so much
  2023-05-29 22:45 [Bug c++/110031] New: ICE: error reporting routines re-entered on non-type template argument stevenxia990430 at gmail dot com
                   ` (8 preceding siblings ...)
  2024-03-07 15:01 ` cvs-commit at gcc dot gnu.org
@ 2024-03-07 15:02 ` mpolacek at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-03-07 15:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12/13/14 Regression]    |[11/12/13 Regression] ICE
                   |ICE with deprecated         |with deprecated attribute
                   |attribute and NTTP and      |and NTTP and diagnostic for
                   |diagnostic for deprecated   |deprecated printed out so
                   |printed out so much         |much

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed on trunk so far.

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

end of thread, other threads:[~2024-03-07 15:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-29 22:45 [Bug c++/110031] New: ICE: error reporting routines re-entered on non-type template argument stevenxia990430 at gmail dot com
2023-05-30  3:41 ` [Bug c++/110031] " pinskia at gcc dot gnu.org
2023-05-30  3:49 ` [Bug c++/110031] [10/11/12/13/14 Regression] ICE with deprecated attribute and NTTP and diagnostic for deprecated printed out so much pinskia at gcc dot gnu.org
2023-05-30  4:31 ` stevenxia990430 at gmail dot com
2023-07-07 10:45 ` [Bug c++/110031] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-01-12 13:57 ` rguenth at gcc dot gnu.org
2024-01-12 13:58 ` rguenth at gcc dot gnu.org
2024-03-04 17:10 ` mpolacek at gcc dot gnu.org
2024-03-04 17:15 ` mpolacek at gcc dot gnu.org
2024-03-07 15:01 ` cvs-commit at gcc dot gnu.org
2024-03-07 15:02 ` [Bug c++/110031] [11/12/13 " mpolacek 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).