Skip to content

warn if class type has alignment greater than "new" provides and doesn't overload operator new #9899

@llvmbot

Description

@llvmbot
Bugzilla Link 9527
Resolution FIXED
Resolved on Jan 24, 2012 15:16
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor

Extended Description

I'd like a new warning that fires whenever a class has alignment that is larger than that provided by the operator new, and doesn't provide its own operator new. We could make it -Wobject-alignment=16 and off by default.

Sample:

class Test {
template
struct SeparateCacheLines {
T data;
} attribute((aligned(64)));

SeparateCacheLines<int> high_contention_data[10];

};

I'd like a warning that fires on class Test, "class Test can not be heap allocated". It should not fire if operator new is overloaded. It should not fire on SeparateCacheLines<> itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions