diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index f9c2c8ac3a7..5295911eb82 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -1051,6 +1051,12 @@ cp_keyword_starts_decl_specifier_p (enum rid keyword) case RID_FLOAT: case RID_DOUBLE: case RID_VOID: + /* CV qualifiers. */ + case RID_CONST: + case RID_VOLATILE: + /* typedef/inline specifiers. */ + case RID_TYPEDEF: + case RID_INLINE: /* GNU extensions. */ case RID_ATTRIBUTE: case RID_TYPEOF: diff --git a/gcc/testsuite/g++.dg/spellcheck-typenames.C b/gcc/testsuite/g++.dg/spellcheck-typenames.C index ff53ecc6303..75f80480e16 100644 --- a/gcc/testsuite/g++.dg/spellcheck-typenames.C +++ b/gcc/testsuite/g++.dg/spellcheck-typenames.C @@ -76,3 +76,38 @@ singed char ch; // { dg-error "1: 'singed' does not name a type; did you mean 's ^~~~~~ signed { dg-end-multiline-output "" } */ + +typdef int my_int; // { dg-error "1: 'typdef' does not name a type; did you mean 'typedef'?" } +/* { dg-begin-multiline-output "" } + typdef int my_int; + ^~~~~~ + typedef + { dg-end-multiline-output "" } */ + +inlien int inline_func(); // { dg-error "1: 'inlien' does not name a type; did you mean 'inline'?" } +/* { dg-begin-multiline-output "" } + inlien int inline_func(); + ^~~~~~ + inline + { dg-end-multiline-output "" } */ + +coonst int ci = 0; // { dg-error "1: 'coonst' does not name a type; did you mean 'const'?" } +/* { dg-begin-multiline-output "" } + coonst int ci = 0; + ^~~~~~ + const + { dg-end-multiline-output "" } */ + +voltil int vi; // { dg-error "1: 'voltil' does not name a type; did you mean 'volatile'?" } +/* { dg-begin-multiline-output "" } + voltil int vi; + ^~~~~~ + volatile + { dg-end-multiline-output "" } */ + +statik int si; // { dg-error "1: 'statik' does not name a type; did you mean 'static'?" } +/* { dg-begin-multiline-output "" } + statik int si; + ^~~~~~ + static + { dg-end-multiline-output "" } */