diff options
-rw-r--r-- | clang/lib/AST/MicrosoftMangle.cpp | 7 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/mangle-ms.cpp | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 24eac84cdd2..a02571e8a0a 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -2040,10 +2040,9 @@ void MicrosoftMangleContextImpl::mangleCXXDtor(const CXXDestructorDecl *D, } void MicrosoftMangleContextImpl::mangleReferenceTemporary(const VarDecl *VD, - raw_ostream &) { - unsigned DiagID = getDiags().getCustomDiagID(DiagnosticsEngine::Error, - "cannot mangle this reference temporary yet"); - getDiags().Report(VD->getLocation(), DiagID); + raw_ostream &Out) { + MicrosoftCXXNameMangler mangler(*this, Out); + mangler.mangle(VD); } void MicrosoftMangleContextImpl::mangleStaticGuardVariable(const VarDecl *VD, diff --git a/clang/test/CodeGenCXX/mangle-ms.cpp b/clang/test/CodeGenCXX/mangle-ms.cpp index 62f98317504..662234f9e6f 100644 --- a/clang/test/CodeGenCXX/mangle-ms.cpp +++ b/clang/test/CodeGenCXX/mangle-ms.cpp @@ -445,3 +445,10 @@ decltype(a) fun(decltype(a) x, decltype(a)) { return x; } // CHECK-DAG: ?fun@PR18022@@YA?AU<unnamed-type-a>@1@U21@0@Z } + +// Binding to a bit-field that requires a temporary. +struct { int bitfield : 3; } object_with_bitfield = { 3 }; +const int &reference_to_bitfield = object_with_bitfield.bitfield; +// CHECK-DAG: ?object_with_bitfield@@3U<unnamed-type-object_with_bitfield>@@A +// CHECK-DAG: ?reference_to_bitfield@@3ABHB +// CHECK-DAG: ??__Ereference_to_bitfield@@YAXXZ |