Skip to content

Initialization of global pointers is accepted by clang++ but rejected by clang #149500

@benshi001

Description

@benshi001

For the following code,

unsigned int * p = &(*(unsigned int *)0x400);

clang++ accepts it, but clang rejects with error

a.c:1:20: error: initializer element is not a compile-time constant
    1 | unsigned int * p = &(*(unsigned int *)0x400);
      |  

Metadata

Metadata

Assignees

No one assigned

    Labels

    cclang:frontendLanguage frontend issues, e.g. anything involving "Sema"diverges-from:gccDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueregression

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions