[cfe-dev] Work around for compiler error parsing 'aligned' attribute? (Bug 11071)?

John McCall rjmccall at apple.com
Thu Feb 28 20:08:24 PST 2013

On Feb 28, 2013, at 7:38 PM, Jeffrey Walton <noloader at gmail.com> wrote:
> I'm very unclear of what is going on with the GNU C/GCC attributes. It
> appears they should work, but they don't. And bugs relating to them
> have gone unacknowledged for years.

We currently don't support that particular attribute in arbitrary type contexts —
in fact, I'm a bit surprised that GCC does.  The reason why is simply that
we don't include alignment qualifiers in our formal type system;  it's something
we've discussed, but we'd want to do it right, and that'd be a pretty large
amount of work.  It would also be technically compatibility-breaking (GCC
also does not include explicit alignment qualifiers as part of its type system
for things like, say, template arguments), but that's not as much of an issue.

We do support "aligned" on arbitrary declarations, including typedefs (with
the major caveat that it still doesn't become part of the formal type system,
so again, it's not a different type for the purposes of things like templates).

We do have a concept of an AttributedType that we could probably use to
hack in support for this specific thing.  Patches welcome.


More information about the cfe-dev mailing list