Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

llvm/Support/AlignOf.h fails to compile with C++0x #6295

Closed Quuxplusone closed 13 years ago

Quuxplusone commented 13 years ago
Bugzilla Link PR8423
Status RESOLVED FIXED
Importance P normal
Reported by Tom Prince (tom.prince@ualberta.net)
Reported on 2010-10-20 06:19:50 -0700
Last modified on 2010-10-30 00:14:26 -0700
Version 2.8
Hardware PC Linux
CC clattner@nondot.org, emilien@tlapale.com, llvm-bugs@lists.llvm.org, nobled@dreamwidth.org
Fixed by commit(s)
Attachments alignof-c++0x.diff (2004 bytes, text/plain)
alignof-c++0x-v2.diff (2502 bytes, text/plain)
Blocks
Blocked by
See also

alignof is a keyword in C++0x, so AlignOf.h fails to compile for C++0x projects using llvm.

Quuxplusone commented 13 years ago

A patch would be welcome to fix this, it is unlikely to be fixed by a random person without one.

Quuxplusone commented 13 years ago

Is it possible to get the same spelling for both c++'0x and c++'98?

Quuxplusone commented 13 years ago
(In reply to comment #3)
> Is it possible to get the same spelling for both c++'0x and c++'98?
Do you mean reimplement the alignof keyword manually for compilers that don't
know nothing about no c++'0x? I guess you could provide a subset of it by
adding something like:

#if !defined(__GXX_EXPERIMENTAL_CXX0X__)
#define alignof(t) alignOf<t>()
#endif

But then detecting whether compiling with -std=c++0x would only work with GCC,
and require using a GCC-specific define that probably isn't even guaranteed to
be around forever once the standard is actually ratified. And -std=c++0x can't
be checked for in the normal way (if __cplusplus >= *month of ratification*L)
until it *is* ratified, so there doesn't seem to be a good way to do that at
all right now.
Quuxplusone commented 13 years ago

Attached alignof-c++0x.diff (2004 bytes, text/plain): rename alignof() to alignOf()

Quuxplusone commented 13 years ago

Attached alignof-c++0x-v2.diff (2502 bytes, text/plain): rename alignof() to alignOf() [v2]

Quuxplusone commented 13 years ago

Thanks, I applied your patch in r117774 and updated clang in 117775