https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84669
Bug ID: 84669
Summary: Error displaying in wrong file for unclosed scopes in
headers
Product: gcc
Version: 7.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: schlong at cock dot li
Target Milestone: ---
Created attachment 43543
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43543&action=edit
Preprocessed file
G++ version:
g++ (Debian 7.3.0-5) 7.3.0
Command line:
g++ ./main.cpp
Compiler output:
./main.cpp:11:1: error: expected ‘}’ at end of input
}
^
Expected behavior:
g++ shows an error indicating a missing closing curly bracket in other.hpp or
keeps the error as it is but also shows where the bracket has been opened.
Since there's no option to add multiple files and you don't want archives, here
are
Content of other.hpp:
namespace NS
{
// Missing closing curly bracket here
Content of main.cpp:
#include "other.hpp"
// }
// Closing curly bracket for @NS. Un-commenting this causes successful
// compilation.
int main(int argc, char *argv[])
{
return 0;
}