http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58589

            Bug ID: 58589
           Summary: diagnostics: missing proper file:line on C++
                    compilation error
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jan.kratochvil at redhat dot com
                CC: dodji at gcc dot gnu.org
            Target: x86_64-unknown-linux-gnu

#include <unordered_map>
#include <memory>
class X {
public:
  int a,&b; /* the reference disables default copy constructor */
  X():b(a) {}
};
class Y {
public:
  std::unordered_map<int,std::unique_ptr<X>> x; /* this hides the error line */
} a,b;
int main() { a=b; }

$ g++ -o test6 test6.C -Wall -std=gnu++11 2>&1|grep test6

Actual:
                 from test6.C:1:
                 from test6.C:1:
                 from test6.C:2:
Expected:
                 from test6.C:5:
(or at ltest test6.C:3)

There are many error lines also mentioning 'X' (although neither 'a' or 'b')
but none of them gives any line number where the problem comes from in test6.C.
Editors/IDE (error line parsers) then cannot show where the error comes from.

Also none of the errors is the one making the cause clear which one gets by
using plain 'X x;' (instead of using 'X' in unordered_map):
test6.C:3:7: error: non-static reference member ‘int& X::b’, can’t use default
assignment operator

BTW clang has the same diagnostics problem.

Reply via email to