Skip to content

#pragma pack for template structs ignored #11191

@llvmbot

Description

@llvmbot
Bugzilla Link 10819
Resolution FIXED
Resolved on Mar 09, 2012 04:26
Version 2.9
OS All
Reporter LLVM Bugzilla Contributor

Extended Description

#pragma pack ignored for template structures. Tested on clang 2.9 on mac and win32. Code:

#include

#pragma pack(1)

struct A
{
int a;
char b;
int c;
};

template
struct B
{
T a;
char b;
T c;
};

int main ()
{
printf ("sizeof A = %u\n", sizeof (A));
printf ("sizeof B = %u\n", sizeof (B));

return 0;
}

Prints:
sizeof A = 9
sizeof B = 12
Should print:
sizeof A = 9
sizeof B = 9

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