[Bug c++/96045] [11 Regression] Wrong line and column diagnostic message in a class template instantiation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96045 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org Resolution|--- |FIXED Status|ASSIGNED|RESOLVED --- Comment #7 from Jakub Jelinek --- Assuming fixed: ./cc1plus.20200929 -quiet pr96045.C pr96045.C:3: error: expected unqualified-id at end of input ./cc1plus.20210107 -quiet pr96045.C pr96045.C:2:15: error: expected unqualified-id at end of input 2 | struct A | ^
[Bug c++/96045] [11 Regression] Wrong line and column diagnostic message in a class template instantiation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96045 --- Comment #6 from CVS Commits --- The master branch has been updated by Iain D Sandoe : https://gcc.gnu.org/g:6037ebeff1cd76385e88dd9cbcaf68ada85316fb commit r11-6343-g6037ebeff1cd76385e88dd9cbcaf68ada85316fb Author: Iain Sandoe Date: Sat Dec 26 19:46:50 2020 + Objective-C++ : Fix up testcase EOF diagnostics. Some Objective-C++ testcases need modification in reponse to the solution to PR 96045. gcc/testsuite/ChangeLog: PR c++/96045 * obj-c++.dg/property/property-neg-6.mm: Adjust EOF diagnostic location. * obj-c++.dg/syntax-error-10.mm: Likewise. * obj-c++.dg/syntax-error-8.mm: Likewise. * obj-c++.dg/syntax-error-9.mm: Likewise.
[Bug c++/96045] [11 Regression] Wrong line and column diagnostic message in a class template instantiation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96045 --- Comment #5 from CVS Commits --- The master branch has been updated by Nathan Sidwell : https://gcc.gnu.org/g:745f22096c3a2a5e63d5bab1fb079e2c437cf9bc commit r11-6325-g745f22096c3a2a5e63d5bab1fb079e2c437cf9bc Author: Nathan Sidwell Date: Wed Dec 23 14:17:17 2020 -0800 c++: EOF location [PR 96045] Setting the EOF token location to be the start of a line just after the ending newline is not most helpful. While that location is probably the right place to report preprocessing and lexing issues, when parsing, the location just after the last token is better. That way we get to point at some actual text. Setting the location from the previous token has the advantage over just setting the location to be the end of the final line, in that any ending comments do not get considered, which I think is better. PR c++/96045 gcc/cp/ * parser.c (cp_lexer_new_main): Adjust EOF token location. gcc/testsuite/ * g++.dg/diagnostic/pr96045-1.C: New. * g++.dg/diagnostic/pr96045-2.C: New. * g++.dg/diagnostic/pr96045-3.C: New. * c-c++-common/goacc/pr79428-1.c: Adjust EOF diagnostic location. * c-c++-common/gomp/pr79428-2.c: Likewise * c-c++-common/raw-string-6.c: Likewise * g++.dg/cpp0x/decltype63.C: Likewise * g++.dg/cpp0x/gen-attrs-64.C: Likewise * g++.dg/cpp0x/pr68726.C: Likewise * g++.dg/cpp0x/pr78341.C: Likewise * g++.dg/cpp1y/pr65202.C: Likewise * g++.dg/cpp1y/pr65340.C: Likewise * g++.dg/cpp1y/pr68578.C: Likewise * g++.dg/cpp1z/class-deduction44.C: Likewise * g++.dg/diagnostic/unclosed-extern-c.C: Likewise * g++.dg/diagnostic/unclosed-function.C: Likewise * g++.dg/diagnostic/unclosed-namespace.C: Likewise * g++.dg/diagnostic/unclosed-struct.C: Likewise * g++.dg/ext/pr84598.C: Likewise * g++.dg/other/switch4.C: Likewise * g++.dg/parse/attr4.C: Likewise * g++.dg/parse/cond4.C: Likewise * g++.dg/parse/crash10.C: Likewise * g++.dg/parse/crash18.C: Likewise * g++.dg/parse/crash27.C: Likewise * g++.dg/parse/crash34.C: Likewise * g++.dg/parse/crash35.C: Likewise * g++.dg/parse/crash52.C: Likewise * g++.dg/parse/crash59.C: Likewise * g++.dg/parse/crash61.C: Likewise * g++.dg/parse/crash67.C: Likewise * g++.dg/parse/error14.C: Likewise * g++.dg/parse/error56.C: Likewise * g++.dg/parse/invalid1.C: Likewise * g++.dg/parse/parameter-declaration-1.C: Likewise * g++.dg/parse/parser-pr28152-2.C: Likewise * g++.dg/parse/parser-pr28152.C: Likewise * g++.dg/parse/pr68722.C: Likewise * g++.dg/parse/pr96258.C: Likewise * g++.dg/pr46852.C: Likewise * g++.dg/pr46868.C: Likewise * g++.dg/template/crash115.C: Likewise * g++.dg/template/crash43.C: Likewise * g++.dg/template/crash90.C: Likewise * g++.dg/template/error-recovery1.C: Likewise * g++.dg/template/error57.C: Likewise * g++.old-deja/g++.other/crash31.C: Likewise
[Bug c++/96045] [11 Regression] Wrong line and column diagnostic message in a class template instantiation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96045 Nathan Sidwell changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |nathan at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #4 from Nathan Sidwell --- There's two conflicting arguments. a) the end of the file is just after the last \n (the preprocessor makes sure the file ends in \n). That's the first column of a line that doesn't exist. b) the EOF is just before the last \n (at the \n itself if you like). IIRC cpplib was taking both positions, and leading to inconsistencies. My intent was #a, as that's the more logical position of being after the \n. But it may not be the best choice. We do have to do some rewinding to deal with that non-existent line #a creates.
[Bug c++/96045] [11 Regression] Wrong line and column diagnostic message in a class template instantiation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96045 --- Comment #3 from Jason Merrill --- Nathan, this PR points out that your change to EOF location means that we no longer show the last line of source to give context for the error. Why not give the EOF token a location of the end of the last line?
[Bug c++/96045] [11 Regression] Wrong line and column diagnostic message in a class template instantiation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96045 Richard Biener changed: What|Removed |Added Priority|P3 |P1
[Bug c++/96045] [11 Regression] Wrong line and column diagnostic message in a class template instantiation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96045 --- Comment #2 from Marek Polacek --- Regressed with r11-338-g2a0225e47868fbfceaecaa5e2de96c1c5a2251ea
[Bug c++/96045] [11 Regression] Wrong line and column diagnostic message in a class template instantiation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96045 Marek Polacek changed: What|Removed |Added Target Milestone|--- |11.0 Ever confirmed|0 |1 Last reconfirmed||2020-07-08 Summary|Wrong line and column |[11 Regression] Wrong line |diagnostic message in a |and column diagnostic |class template |message in a class template |instantiation |instantiation Status|UNCONFIRMED |NEW CC||mpolacek at gcc dot gnu.org --- Comment #1 from Marek Polacek --- Confirmed. Interestingly, GCC 10 was much better: $ xg++-10 -c 96045.C 96045.C:2:8: error: expected unqualified-id at end of input 2 | struct A |^~~