This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13560] New: wrong file name in error message


Compile the following and you will get:
test.h: In function `int main()':
test.h:3: error: `int t::g' is private
test.cc:7: error: within this context
See how it says main is in test.h, this is wrong.
The problem is in cp_error_at set the location information but since the "In function ..." 
has not been printed yet for this function so it prints with the location information which 
cp_error_at sets which is wrong, one way to fix this is to add a new location_t to 
diagnostic_info to store the old one for printing out the "In function ..." message.

----- preprocessed source -----
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.cc"
# 1 "test.h" 1
class t
{
 int g;
};
void h(t&);
# 2 "test.cc" 2

int main()
{
  t y;
  h(y);
  return y.g;
}

-- 
           Summary: wrong file name in error message
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c++
        AssignedTo: gdr at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: carlo at alinoe dot com,gcc-bugs at gcc dot gnu dot
                    org,igodard at pacbell dot net


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]