Skip to content

C23 parsing of auto type inference doesn't correctly consider typedefs #164930

@Halalaluyafail3

Description

@Halalaluyafail3

The following program demonstrates the issue:

int main(){
    typedef int x;
    {
        auto x y;
    }
}

The declaration auto x y; should be "declaration of y with type x" where auto has no effect because it's not specifying type inference here. However, in C23 mode Clang will see the x after auto and then assume that it should be "declaration of x with inferred type". Afterwards it will then complain because there is no initializer. GCC and Clang in pre-C23 modes will accept this code. Related to #164921 example 3, but I split this into a separate issue because it changes the meaning of valid code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c23clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions