![]() As mentioned in my Cauldron talk, this patch adds a call to diagnostic_show_locus to the "required from here" messages in print_instantiation_partial_context_line, so that e.g., rather than the rather mystifying: In file included from ../x86_64-pc-linux-gnu/libstdc++-v3/include/memory:78, from ../../src/demo-1.C:1: ../x86_64-pc-linux-gnu/libstdc++-v3/include/bits/unique_ptr.h: In instantiation of ‘std::__detail::__unique_ptr_t<_Tp> std::make_unique(_Args&& ...) [with _Tp = bar; _Args = {}; __detail::__unique_ptr_t<_Tp> = __detail::__unique_ptr_t<bar>]’: ../../src/demo-1.C:15:32: required from here ../x86_64-pc-linux-gnu/libstdc++-v3/include/bits/unique_ptr.h:1066:30: error: no matching function for call to ‘bar::bar()’ 1066 | { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../src/demo-1.C:10:3: note: candidate: ‘bar::bar(int)’ 10 | bar (int); | ^~~ ../../src/demo-1.C:10:3: note: candidate expects 1 argument, 0 provided ../../src/demo-1.C:7:7: note: candidate: ‘constexpr bar::bar(const bar&)’ 7 | class bar : public foo | ^~~ ../../src/demo-1.C:7:7: note: candidate expects 1 argument, 0 provided ../../src/demo-1.C:7:7: note: candidate: ‘constexpr bar::bar(bar&&)’ ../../src/demo-1.C:7:7: note: candidate expects 1 argument, 0 provided we emit: In file included from ../x86_64-pc-linux-gnu/libstdc++-v3/include/memory:78, from ../../src/demo-1.C:1: ../x86_64-pc-linux-gnu/libstdc++-v3/include/bits/unique_ptr.h: In instantiation of ‘std::__detail::__unique_ptr_t<_Tp> std::make_unique(_Args&& ...) [with _Tp = bar; _Args = {}; __detail::__unique_ptr_t<_Tp> = __detail::__unique_ptr_t<bar>]’: ../../src/demo-1.C:15:32: required from here 15 | return std::make_unique<bar> (); | ~~~~~~~~~~~~~~~~~~~~~~^~ ../x86_64-pc-linux-gnu/libstdc++-v3/include/bits/unique_ptr.h:1066:30: error: no matching function for call to ‘bar::bar()’ 1066 | { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../src/demo-1.C:10:3: note: candidate: ‘bar::bar(int)’ 10 | bar (int); | ^~~ ../../src/demo-1.C:10:3: note: candidate expects 1 argument, 0 provided ../../src/demo-1.C:7:7: note: candidate: ‘constexpr bar::bar(const bar&)’ 7 | class bar : public foo | ^~~ ../../src/demo-1.C:7:7: note: candidate expects 1 argument, 0 provided ../../src/demo-1.C:7:7: note: candidate: ‘constexpr bar::bar(bar&&)’ ../../src/demo-1.C:7:7: note: candidate expects 1 argument, 0 provided which shows the code that's leading to the error (the bad call to std::make_unique). gcc/cp/ChangeLog: * error.cc (print_instantiation_partial_context_line): Call diagnostic_show_locus. gcc/testsuite/ChangeLog: * g++.dg/diagnostic/static_assert3.C: Add directives for additional source printing. * g++.dg/template/error60.C: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com> |
||
---|---|---|
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
intl | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgm2 | ||
libgo | ||
libgomp | ||
libiberty | ||
libitm | ||
libobjc | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.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 | ||
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.