https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118812
Bug ID: 118812
Summary: Improve diagnostic for non class used as a base class
(even a typedef)
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Very much related to PR101519.
take:
```
typedef int t;
struct C : t { };
```
Currently GCC outputs:
```
<source>:2:14: error: expected class-name before '{' token
2 | struct C : t { };
| ^
```
But it is not obvious what it means, it is even worse with type alias like:
```
template<typename X>
using t = X;
struct C : t<int> { };
```
At least with a dependent name, GCC provides a decent error message.
That is:
```
template<typename X>
using t = X;
template <typename X>
struct C : t<X> { };
C<int> a;
```
Gives:
```
<source>: In instantiation of 'struct C<int>':
<source>:5:8: required from here
5 | C<int> a;
| ^
<source>:4:8: error: base type 't<int>' {aka 'int'} fails to be a struct or
class type
4 | struct C : t<X> { };
| ^
```