public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106197] New: Ignoring error line then falls into infinite recursion in constexpr function
@ 2022-07-05  6:19 asd1366464124 at gmail dot com
  0 siblings, 0 replies; only message in thread
From: asd1366464124 at gmail dot com @ 2022-07-05  6:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106197
           Summary: Ignoring error line then falls into infinite recursion
                    in constexpr function
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asd1366464124 at gmail dot com
  Target Milestone: ---

Created attachment 53258
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53258&action=edit
wrong code that cause infinite recursion.

command line:g++11 -v -save-temps -Wall -Wextra -std=c++20 -fconstexpr-depth=10
a.cpp
output:
a.cpp: In function ‘consteval int fib(int)’:
a.cpp:5:5: error: ‘i’ was not declared in this scope
    5 |     i if constexpr (n == 0 || n == 1) return 1;
      |     ^
a.cpp: In function ‘int main()’:
a.cpp:11:27:   in ‘constexpr’ expansion of ‘fib(1)’
a.cpp:6:15:   in ‘constexpr’ expansion of ‘fib((n - 1))’
a.cpp:6:15:   in ‘constexpr’ expansion of ‘fib((n - 1))’
a.cpp:6:15:   in ‘constexpr’ expansion of ‘fib((n - 1))’
a.cpp:6:15:   in ‘constexpr’ expansion of ‘fib((n - 1))’
a.cpp:6:15:   in ‘constexpr’ expansion of ‘fib((n - 1))’
a.cpp:6:15:   in ‘constexpr’ expansion of ‘fib((n - 1))’
a.cpp:6:15:   in ‘constexpr’ expansion of ‘fib((n - 1))’
a.cpp:6:15:   in ‘constexpr’ expansion of ‘fib((n - 1))’
a.cpp:6:15:   in ‘constexpr’ expansion of ‘fib((n - 1))’
a.cpp:6:15:   in ‘constexpr’ expansion of ‘fib((n - 1))’
a.cpp:11:27: error: ‘constexpr’ evaluation depth exceeds maximum of 10 (use
‘-fconstexpr-depth=’ to increase the maximum)
   11 |     constexpr auto i = fib(1);
      |                        ~~~^~~

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-05  6:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05  6:19 [Bug c++/106197] New: Ignoring error line then falls into infinite recursion in constexpr function asd1366464124 at gmail dot com

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).