mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-20 13:31:10 +08:00
If the user fails to close an extern "C" linkage specifier, and then uses templates, they will run into "template with C linkage" errors. From personal experience, it can be hard to tell where the extern "C" began. As of r251026 there will be a message highlighting the unclosed '{', but this may be hard to spot at the very end of the errors. This patch adds a note to the various diagnostics that complain about C linkage, showing the user where the extern "C" specification began. gcc/cp/ChangeLog: * cp-tree.h (maybe_show_extern_c_location): New decl. * decl.c (grokfndecl): When complaining about literal operators with C linkage, issue a note giving the location of the extern "C". * parser.c (cp_parser_new): Initialize new field "innermost_linkage_specification_location". (cp_parser_linkage_specification): Store the location of the linkage specification within the cp_parser. (cp_parser_explicit_specialization): When complaining about template specializations with C linkage, issue a note giving the location of the extern "C". (cp_parser_explicit_template_declaration): Likewise for templates. (maybe_show_extern_c_location): New function. * parser.h (struct cp_parser): New field "innermost_linkage_specification_location". gcc/testsuite/ChangeLog: * g++.dg/cpp0x/udlit-extern-c.C: New test case. * g++.dg/diagnostic/unclosed-extern-c.C: Add example of a template erroneously covered by an unclosed extern "C". * g++.dg/template/extern-c.C: New test case. From-SVN: r253726
…
…
…
…
…
…
…
…
…
…
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.
Description
Languages
C++
31.9%
C
31.3%
Ada
12%
D
6.5%
Go
6.4%
Other
11.5%