[Bug c++/93710] poor location in diagnostics of messages about array initializers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93710 Marek Polacek changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #6 from Marek Polacek --- Fixed.
[Bug c++/93710] poor location in diagnostics of messages about array initializers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93710 Marek Polacek changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #6 from Marek Polacek --- Fixed.
[Bug c++/93710] poor location in diagnostics of messages about array initializers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93710 --- Comment #5 from CVS Commits --- The master branch has been updated by Marek Polacek : https://gcc.gnu.org/g:eef65c474e6836cc0470eb84f28895050161fcb8 commit r10-6657-geef65c474e6836cc0470eb84f28895050161fcb8 Author: Marek Polacek Date: Wed Feb 12 14:00:51 2020 -0500 c++: Fix poor diagnostic for array initializer [PR93710] A small improvement for an error in build_user_type_conversion_1: instead of array-init1.C:11:1: error: conversion from ‘long int’ to ‘A’ is ambiguous 11 | }; | ^ we will print array-init1.C:8:3: error: conversion from ‘long int’ to ‘A’ is ambiguous 8 | 0L, | ^~ 2020-02-12 Marek Polacek PR c++/93710 - poor diagnostic for array initializer. * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc for an error call. * g++.dg/diagnostic/array-init1.C: New test.
[Bug c++/93710] poor location in diagnostics of messages about array initializers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93710 Eric Gallager changed: What|Removed |Added CC||egallager at gcc dot gnu.org --- Comment #4 from Eric Gallager --- I think there's another bug about this, but I forget its number...
[Bug c++/93710] poor location in diagnostics of messages about array initializers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93710 Marek Polacek changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
[Bug c++/93710] poor location in diagnostics of messages about array initializers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93710 --- Comment #3 from Marek Polacek --- For the whole testcase with the patch we generate: 93710-2.C:6:3: error: conversion from ‘long int’ to ‘A’ is ambiguous 6 | 0L, | ^~ 93710-2.C:1:21: note: candidate: ‘A::A(char*)’ 1 | struct A { A (int); A (char*); int i; }; | ^ 93710-2.C:1:12: note: candidate: ‘A::A(int)’ 1 | struct A { A (int); A (char*); int i; }; |^ 93710-2.C:7:3: error: invalid conversion from ‘int*’ to ‘int’ [-fpermissive] 7 | , // accurate location | ^~ | | | int* 93710-2.C:1:15: note: initializing argument 1 of ‘A::A(int)’ 1 | struct A { A (int); A (char*); int i; }; | ^~~ 93710-2.C:9:23: error: conversion from ‘long unsigned int’ to ‘A’ is ambiguous 9 | __builtin_offsetof (A, i) | ^ 93710-2.C:1:21: note: candidate: ‘A::A(char*)’ 1 | struct A { A (int); A (char*); int i; }; | ^ 93710-2.C:1:12: note: candidate: ‘A::A(int)’ 1 | struct A { A (int); A (char*); int i; }; |^ Testing pending.
[Bug c++/93710] poor location in diagnostics of messages about array initializers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93710 --- Comment #2 from Marek Polacek --- With --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4172,8 +4172,9 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags, if (complain & tf_error) { auto_diagnostic_group d; - error ("conversion from %qH to %qI is ambiguous", -fromtype, totype); + error_at (EXPR_LOCATION (expr), + "conversion from %qH to %qI is ambiguous", + fromtype, totype); print_z_candidates (location_of (expr), candidates); } we print 93710.C:6:3: error: conversion from ‘long int’ to ‘A’ is ambiguous 6 | 0L, | ^~ 93710.C:1:21: note: candidate: ‘A::A(char*)’ 1 | struct A { A (int); A (char*); int i; }; | ^ 93710.C:1:12: note: candidate: ‘A::A(int)’ 1 | struct A { A (int); A (char*); int i; }; |^ which seems much better.
[Bug c++/93710] poor location in diagnostics of messages about array initializers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93710 Marek Polacek changed: What|Removed |Added Keywords||diagnostic Status|UNCONFIRMED |NEW Last reconfirmed||2020-02-12 CC||mpolacek at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Marek Polacek --- Confirmed.