![]() In examining the coroutine testcases for unexpected diagnostic output for 'Wall', I found a 'statement has no effect' warning for the promise construction in one case. In particular, the case is where the users promise type has an implicit CTOR but a user-provided DTOR. Further, the type does not actually need constructing. In very early versions of the coroutines code we used to check TYPE_NEEDS_CONSTRUCTING() to determine whether to attempt to build a constructor call for the promise. During review, it was suggested to use type_build_ctor_call () instead. This latter call checks the constructors in the type (both user-defined and implicit) and returns true, amongst other cases if any of the found CTORs are marked as deprecated. In a number of places (for example [class.copy.ctor] / 6) the standard says that some version of an implicit CTOR is deprecated when the user provides a DTOR. Thus, for this specific arrangement of promise type, type_build_ctor_call returns true, because of (for example) a deprecated implicit copy CTOR. We are not going to use any of the deprecated CTORs and thus will not see warnings from this - however, since the call returned true, we have now determined that we should attempt to build a constructor call. Note as above, the type does not actually require construction and thus one might expect either a NULL_TREE or error_mark_node in response to the build_special_member_call (). However, in practice the function returns the original instance object instead of a call or some error. When we add that as a statement it triggers the 'statement has no effect' warning. The patch here rearranges the promise construction/destruction code to allow for the case that a DTOR is required independently of a CTOR. In addition, we check that the return from build_special_member_call () has side effects before we add it as a statement. gcc/cp/ChangeLog: * coroutines.cc (cp_coroutine_transform::build_ramp_function): Separate the build of promise constructor and destructor. When evaluating the constructor, check that build_special_member_call returns an expression with side effects before adding it. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> |
||
---|---|---|
.github | ||
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgm2 | ||
libgo | ||
libgomp | ||
libgrust | ||
libiberty | ||
libitm | ||
libobjc | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.b4-config | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
COPYING3 | ||
COPYING3.LIB | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
lt~obsolete.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
SECURITY.txt | ||
symlink-tree | ||
test-driver | ||
ylwrap |
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.