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
b9760b03
Commit
b9760b03
authored
Oct 05, 2017
by
Jason Merrill
Committed by
Jason Merrill
Oct 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* call.c (convert_arg_to_ellipsis): Use the result of force_rvalue.
From-SVN: r253465
parent
e58683fb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
12 deletions
+33
-12
gcc/cp/ChangeLog
+4
-0
gcc/cp/call.c
+12
-12
gcc/testsuite/g++.dg/ext/varargs2.C
+17
-0
No files found.
gcc/cp/ChangeLog
View file @
b9760b03
2017-10-05 Jason Merrill <jason@redhat.com>
* call.c (convert_arg_to_ellipsis): Use the result of force_rvalue.
2017-10-05 Nathan Sidwell <nathan@acm.org>
2017-10-05 Nathan Sidwell <nathan@acm.org>
Warn on MVP declarations
Warn on MVP declarations
...
...
gcc/cp/call.c
View file @
b9760b03
...
@@ -7165,29 +7165,24 @@ convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain)
...
@@ -7165,29 +7165,24 @@ convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain)
/* In a template (or ill-formed code), we can have an incomplete type
/* In a template (or ill-formed code), we can have an incomplete type
even after require_complete_type_sfinae, in which case we don't know
even after require_complete_type_sfinae, in which case we don't know
whether it has trivial copy or not. */
whether it has trivial copy or not. */
&&
COMPLETE_TYPE_P
(
arg_type
))
&&
COMPLETE_TYPE_P
(
arg_type
)
&&
!
cp_unevaluated_operand
)
{
{
/* Build up a real lvalue-to-rvalue conversion in case the
copy constructor is trivial but not callable. */
if
(
!
cp_unevaluated_operand
&&
CLASS_TYPE_P
(
arg_type
))
force_rvalue
(
arg
,
complain
);
/* [expr.call] 5.2.2/7:
/* [expr.call] 5.2.2/7:
Passing a potentially-evaluated argument of class type (Clause 9)
Passing a potentially-evaluated argument of class type (Clause 9)
with a non-trivial copy constructor or a non-trivial destructor
with a non-trivial copy constructor or a non-trivial destructor
with no corresponding parameter is conditionally-supported, with
with no corresponding parameter is conditionally-supported, with
implementation-defined semantics.
implementation-defined semantics.
We support it as pass-by-invisible-reference to the caller's
We support it as pass-by-invisible-reference, just like a normal
object. That's different to named by-value parameters, which
value parameter.
construct a copy and pass a reference to that.
If the call appears in the context of a sizeof expression,
If the call appears in the context of a sizeof expression,
it is not potentially-evaluated. */
it is not potentially-evaluated. */
if
(
cp_unevaluated_operand
==
0
if
(
type_has_nontrivial_copy_init
(
arg_type
)
&&
(
type_has_nontrivial_copy_init
(
arg_type
)
||
TYPE_HAS_NONTRIVIAL_DESTRUCTOR
(
arg_type
))
||
TYPE_HAS_NONTRIVIAL_DESTRUCTOR
(
arg_type
)))
{
{
arg
=
force_rvalue
(
arg
,
complain
);
if
(
complain
&
tf_warning
)
if
(
complain
&
tf_warning
)
warning
(
OPT_Wconditionally_supported
,
warning
(
OPT_Wconditionally_supported
,
"passing objects of non-trivially-copyable "
"passing objects of non-trivially-copyable "
...
@@ -7195,6 +7190,11 @@ convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain)
...
@@ -7195,6 +7190,11 @@ convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain)
arg_type
);
arg_type
);
return
cp_build_addr_expr
(
arg
,
complain
);
return
cp_build_addr_expr
(
arg
,
complain
);
}
}
/* Build up a real lvalue-to-rvalue conversion in case the
copy constructor is trivial but not callable. */
else
if
(
CLASS_TYPE_P
(
arg_type
))
force_rvalue
(
arg
,
complain
);
}
}
return
arg
;
return
arg
;
...
...
gcc/testsuite/g++.dg/ext/varargs2.C
0 → 100644
View file @
b9760b03
// { dg-do run }
int
c
;
struct
X
{
X
()
{};
X
(
const
X
&
)
{
++
c
;
}
};
void
Foo
(
X
,
...)
{}
void
bin
(
X
&
p
)
{
Foo
(
p
,
p
);
}
int
main
()
{
X
x
;
bin
(
x
);
if
(
c
!=
2
)
__builtin_abort
();
}
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