Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Sema] Mark the referenced destructor during transformation of a `CXX…
…BindTemporaryExpr` Otherwise we will fail to generate the definition of a defaulted destructor, if the only reference was in a templated temporary. rdar://89366678 Differential Revision: https://reviews.llvm.org/D120426
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
clang/test/SemaTemplate/defaulted-destructor-in-temporary.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// RUN: %clang_cc1 -std=c++11 -triple=x86_64-apple-darwin %s -emit-llvm -o - | FileCheck %s | ||
|
||
// CHECK: define linkonce_odr {{.*}} @_ZN3StrD1Ev | ||
|
||
class A { | ||
public: | ||
~A(); | ||
}; | ||
class Str { | ||
A d; | ||
|
||
public: | ||
~Str() = default; | ||
}; | ||
class E { | ||
Str s; | ||
template <typename> | ||
void h() { | ||
s = {}; | ||
} | ||
void f(); | ||
}; | ||
void E::f() { | ||
h<int>(); | ||
} |