Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
llvm-epi-0.8
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Roger Ferrer
llvm-epi-0.8
Commits
1d197174
Commit
1d197174
authored
13 years ago
by
Sebastian Redl
Browse files
Options
Downloads
Patches
Plain Diff
Add a testcase to show that temporaries from the initializer list are destroyed correctly.
llvm-svn: 150924
parent
ca89d684
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
+30
-0
30 additions, 0 deletions
.../test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
with
30 additions
and
0 deletions
clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
+
30
−
0
View file @
1d197174
...
...
@@ -58,12 +58,17 @@ struct destroyme1 {
struct
destroyme2
{
~
destroyme2
();
};
struct
witharg1
{
witharg1
(
const
destroyme1
&
);
~
witharg1
();
};
void
fn2
()
{
// CHECK: define void @_Z3fn2v
void
target
(
std
::
initializer_list
<
destroyme1
>
);
// objects should be destroyed before dm2, after call returns
// CHECK: call void @_Z6targetSt16initializer_listI10destroyme1E
target
({
destroyme1
(),
destroyme1
()
});
// CHECK: call void @_ZN10destroyme1D1Ev
destroyme2
dm2
;
...
...
@@ -78,3 +83,28 @@ void fn3() {
// CHECK: call void @_ZN10destroyme2D1Ev
// CHECK: call void @_ZN10destroyme1D1Ev
}
void
fn4
()
{
// CHECK: define void @_Z3fn4v
void
target
(
std
::
initializer_list
<
witharg1
>
);
// objects should be destroyed before dm2, after call returns
// CHECK: call void @_ZN8witharg1C1ERK10destroyme1
// CHECK: call void @_Z6targetSt16initializer_listI8witharg1E
target
({
witharg1
(
destroyme1
()),
witharg1
(
destroyme1
())
});
// CHECK: call void @_ZN8witharg1D1Ev
// CHECK: call void @_ZN10destroyme1D1Ev
destroyme2
dm2
;
// CHECK: call void @_ZN10destroyme2D1Ev
}
void
fn5
()
{
// CHECK: define void @_Z3fn5v
// temps should be destroyed before dm2
// objects should be destroyed after dm2
// CHECK: call void @_ZN8witharg1C1ERK10destroyme1
auto
list
=
{
witharg1
(
destroyme1
()),
witharg1
(
destroyme1
())
};
// CHECK: call void @_ZN10destroyme1D1Ev
destroyme2
dm2
;
// CHECK: call void @_ZN10destroyme2D1Ev
// CHECK: call void @_ZN8witharg1D1Ev
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment