Failing test SemaCXX/underlying_type.cpp on Mingw/Msys


SemaCXX/underlying_type.cpp fails on Mingw/Msys with the following message:

Assertion failed: (PtrVal & ((1 << PtrTraits::NumLowBitsAvailable)-1)) == 0 && “Pointer is not sufficiently aligned”, file d:/clang/llvm/include/llvm/ADT/PointerIntPair.h, line 80

From this function:

void setPointer(PointerTy Ptr) {
intptr_t PtrVal
= reinterpret_cast<intptr_t>(PtrTraits::getAsVoidPointer(Ptr));
assert((PtrVal & ((1 << PtrTraits::NumLowBitsAvailable)-1)) == 0 &&
“Pointer is not sufficiently aligned”);
// Preserve all low bits, just update the pointer.
Value = PtrVal | (Value & ~PointerBitMask);

I don’t know whether the problem only occurs on mingw/msys or also occurs on a “bare” windows system.

– Matthieu.

Also occurs on bare Windows, at least according to some Apple-internal
buildbots. A backtrace would be helpful.

This is most likely caused by r132017; Sean, any ideas?


The problem is here:

+ UnaryTransformType *Ty =
+ new UnaryTransformType (BaseType, UnderlyingType, Kind,
+ UnderlyingType->isDependentType() ?
+ QualType() : UnderlyingType);

I believe I've fixed the issue in r132064.

  - Doug

2011/5/25 Douglas Gregor <>