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

            Bug ID: 115516
           Summary: constexpr use before C23 could give a better error
                    message
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: enhancement
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
constexpr int j = 1;
```

Currently we give:
```
<source>:1:10: error: expected ';' before 'int'
    1 | constexpr int j = 1;
      |          ^~~~
      |          ;
```

This could give a better error message just like the C++ front-end does for
C++98:
```
<source>:1:1: error: 'constexpr' does not name a type
    1 | constexpr int j = 1;
      | ^~~~~~~~~
<source>:1:1: note: C++11 'constexpr' only available with '-std=c++11' or
'-std=gnu++11'
```

Reply via email to