Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
27afd940
Commit
27afd940
authored
Oct 05, 2016
by
Jason Merrill
Committed by
Jason Merrill
Oct 05, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* call.c (extend_ref_init_temps): Fix TARGET_EXPR handling.
From-SVN: r240818
parent
eee8f0b0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
14 deletions
+44
-14
gcc/cp/ChangeLog
+2
-0
gcc/cp/call.c
+17
-14
gcc/testsuite/g++.dg/cpp1z/elide2.C
+25
-0
No files found.
gcc/cp/ChangeLog
View file @
27afd940
2016-10-05 Jason Merrill <jason@redhat.com>
* call.c (extend_ref_init_temps): Fix TARGET_EXPR handling.
* parser.c (cp_parser_skip_to_end_of_statement): Add missing break.
* semantics.c (finish_compound_literal): Handle class placeholder.
...
...
gcc/cp/call.c
View file @
27afd940
...
...
@@ -10172,28 +10172,31 @@ extend_ref_init_temps (tree decl, tree init, vec<tree, va_gc> **cleanups)
return
init
;
if
(
TREE_CODE
(
type
)
==
REFERENCE_TYPE
)
init
=
extend_ref_init_temps_1
(
decl
,
init
,
cleanups
);
else
if
(
is_std_init_list
(
type
))
else
{
/* The temporary array underlying a std::initializer_list
is handled like a reference temporary. */
tree
ctor
=
init
;
if
(
TREE_CODE
(
ctor
)
==
TARGET_EXPR
)
ctor
=
TARGET_EXPR_INITIAL
(
ctor
);
if
(
TREE_CODE
(
ctor
)
==
CONSTRUCTOR
)
{
tree
array
=
CONSTRUCTOR_ELT
(
ctor
,
0
)
->
value
;
array
=
extend_ref_init_temps_1
(
decl
,
array
,
cleanups
);
CONSTRUCTOR_ELT
(
ctor
,
0
)
->
value
=
array
;
if
(
is_std_init_list
(
type
))
{
/* The temporary array underlying a std::initializer_list
is handled like a reference temporary. */
tree
array
=
CONSTRUCTOR_ELT
(
ctor
,
0
)
->
value
;
array
=
extend_ref_init_temps_1
(
decl
,
array
,
cleanups
);
CONSTRUCTOR_ELT
(
ctor
,
0
)
->
value
=
array
;
}
else
{
unsigned
i
;
constructor_elt
*
p
;
vec
<
constructor_elt
,
va_gc
>
*
elts
=
CONSTRUCTOR_ELTS
(
ctor
);
FOR_EACH_VEC_SAFE_ELT
(
elts
,
i
,
p
)
p
->
value
=
extend_ref_init_temps
(
decl
,
p
->
value
,
cleanups
);
}
}
}
else
if
(
TREE_CODE
(
init
)
==
CONSTRUCTOR
)
{
unsigned
i
;
constructor_elt
*
p
;
vec
<
constructor_elt
,
va_gc
>
*
elts
=
CONSTRUCTOR_ELTS
(
init
);
FOR_EACH_VEC_SAFE_ELT
(
elts
,
i
,
p
)
p
->
value
=
extend_ref_init_temps
(
decl
,
p
->
value
,
cleanups
);
}
return
init
;
}
...
...
gcc/testsuite/g++.dg/cpp1z/elide2.C
0 → 100644
View file @
27afd940
// DR 1697
// { dg-do run { target c++11 } }
#define assert(X) do { if (!(X)) __builtin_abort(); } while(0)
int
i
;
struct
S
{
~
S
()
{
assert
(
i
++
==
2
);
}
};
struct
X
{
X
()
{
assert
(
i
++
==
0
);
}
X
(
const
X
&
);
};
struct
T
{
S
&&
s
;
X
x
;
};
void
f
()
{
assert
(
i
++
==
1
);
}
int
main
()
{
{
T
t
=
T
{
{},
{}
};
f
();
}
assert
(
i
==
3
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment