Skip to content

attributes on type in new-expression are silently ignored #47221

@llvmbot

Description

@llvmbot
Bugzilla Link 47877
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @AaronBallman,@DougGregor,@zygoloid

Extended Description

Hi, the following code allocates memory for an integer variable a with 5, which is not an integral power of two. However, Clang accepts it.

Please take a look at paragraph [4]:
http://eel.is/c++draft/basic.align

$ cat s.cpp
void * a = new int __attribute__ ((aligned (5)))();

$ g++ -c s.cpp
s.cpp:1:48: error: requested alignment ‘5’ is not a positive power of 2
    1 | void * a = new int __attribute__ ((aligned (5)))();

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++clang: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