public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "stevenxia990430 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/109012] New: Repeated error messages when using -std=c++23
Date: Fri, 03 Mar 2023 16:33:24 +0000	[thread overview]
Message-ID: <bug-109012-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 109012
           Summary: Repeated error messages when using -std=c++23
           Product: gcc
           Version: 12.2.1
            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 incomplete program repeatedly reports the same error message on
GCC 12 with “-std=c++23” flag.

To quickly reproduce: https://gcc.godbolt.org/z/Ehzde5o4T

```
#include <iostream>

template <class T>
myClass<myClass<myClass<myClass<myClass<T>>>>> myFunction(T item)
{
    std::cout << "Hello World!";
}
```

So the C++23 parser seems to have a bug. If we remove “-std=c++23” it only
reports the concise error message once: https://gcc.godbolt.org/z/38Gxne859

Additionally, this also occurs for even syntactically invalid code snippets.
For example this code

```
myClass<myClass<myClass<myClass<myClass<int>>>>>((( myFunction(int item)
```

Also observe the same behavior, although clearly it is syntactically invalid.

This correct program compiles in less than 1 second with “g++ -c -std=c++23
correct.cpp”

```
#include <iostream>

template<typename T>
class myClass {
public:
    void myFunction(const T item);
};

template <class T>
myClass<myClass<myClass<myClass<myClass<T>>>>> myFunction(T item)
{
    std::cout << "Hello World!";
}
```
correct.cpp

             reply	other threads:[~2023-03-03 16:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-03 16:33 stevenxia990430 at gmail dot com [this message]
2023-03-06  8:26 ` [Bug c++/109012] " rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109012-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).