{"action":"opened","issue":{"url":"https://api.github.com/repos/antlr/antlr4/issues/1457","repository_url":"https://api.github.com/repos/antlr/antlr4","labels_url":"https://api.github.com/repos/antlr/antlr4/issues/1457/labels{/name}","comments_url":"https://api.github.com/repos/antlr/antlr4/issues/1457/comments","events_url":"https://api.github.com/repos/antlr/antlr4/issues/1457/events","html_url":"https://github.com/antlr/antlr4/issues/1457","id":193867904,"number":1457,"title":"[Cpp] namespace pollution of the antlr4 namespace from generated lexer/parser","user":{"login":"Naios","id":1146834,"avatar_url":"https://avatars.githubusercontent.com/u/1146834?v=3","gravatar_id":"","url":"https://api.github.com/users/Naios","html_url":"https://github.com/Naios","followers_url":"https://api.github.com/users/Naios/followers","following_url":"https://api.github.com/users/Naios/following{/other_user}","gists_url":"https://api.github.com/users/Naios/gists{/gist_id}","starred_url":"https://api.github.com/users/Naios/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Naios/subscriptions","organizations_url":"https://api.github.com/users/Naios/orgs","repos_url":"https://api.github.com/users/Naios/repos","events_url":"https://api.github.com/users/Naios/events{/privacy}","received_events_url":"https://api.github.com/users/Naios/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-06T19:51:42Z","updated_at":"2016-12-06T19:51:42Z","closed_at":null,"body":"50646a6da8\r\n\r\nGenerated C++ parsers and lexers are making the `antlr4` scope globally available through a\r\n`using namespace antlr4` statement in the generated *Parser.h and *Lexer.h which leads to a namespace pollution, especially when not using an custom namespace (`-package` option).\r\n\r\nSee the sources from the cpp target demo project:\r\n\r\nTParser.h\r\n```c++\r\n/* parser postinclude section */\r\nusing namespace antlr4;\r\n/* parser context section */\r\n```\r\n\r\nThe expected behaviour is that included headers never make namespaces globally available,\r\nwhich means the `using namespace antlr4` statement needs to be removed but this could break existing\r\ncode including generated headers while not fully qualifying classes in the `antlr4` namespace.\r\n\r\nSee http://stackoverflow.com/questions/5849457/using-namespace-in-c-headers for details."}}
{"actor":{"display_login":"Naios"}}