Index: lib/AST/ItaniumMangle.cpp =================================================================== --- lib/AST/ItaniumMangle.cpp +++ lib/AST/ItaniumMangle.cpp @@ -2326,6 +2326,12 @@ // substitution at the original type. } + // __unaligned is not currently mangled in any way. This implies that it is + // not a relevant qualifier for substitutions (while CVR and maybe others + // are). This triggers an assertion when this is the only qualifier and the + // unqualified type is a class. So let's remove it preventively here. + quals.removeUnaligned(); + if (quals) { mangleQualifiers(quals); // Recurse: even if the qualified type isn't yet substitutable, Index: test/CodeGenCXX/pr33080.cpp =================================================================== --- /dev/null +++ test/CodeGenCXX/pr33080.cpp @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -triple %itanium_abi_triple -fms-extensions -emit-llvm -o- %s | FileCheck %s + +void f(__unaligned struct A*) {} + +// CHECK: define void @_Z1fP1A(%struct.A*)