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

            Bug ID: 90529
           Summary: suggest struct or class
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jg at jguk dot org
  Target Milestone: ---

Perhaps g++ could suggest the missing 'struct' or 'class for the following?

typedef a
{
    int a;
} a_t;


gcc trunk
#1 with x86-64 gcc (trunk)
./example.cpp:1:9: error: 'a' does not name a type
    1 | typedef a
      |         ^
./example.cpp:4:3: error: 'a_t' does not name a type
    4 | } a_t;
      |   ^~~
Compiler returned: 1


clang trunk
#1 with x86-64 clang (trunk)
./example.cpp:1:9: error: C++ requires a type specifier for all declarations
typedef a
~~~~~~~ ^
./example.cpp:3:9: error: expected '(' for function-style cast or type
construction
    int a;
    ~~~ ^
./example.cpp:4:2: error: expected ';' after top level declarator
} a_t;
 ^
 ;
3 errors generated.
Compiler returned: 1



Another variation, could still suggest for ?

typedef
{
    int a;
} a_t;

Reply via email to