[LLVMbugs] [Bug 18948] New: -frewrite-includes causes -Wheader-hygiene false positives

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Feb 24 07:41:05 PST 2014


            Bug ID: 18948
           Summary: -frewrite-includes causes -Wheader-hygiene false
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mostynb at opera.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Using -Wheader-hygiene with output from -frewrite-includes -E gives a false
positive "using namespace directive in global context in header" warning.

Minimised testcase:

void foo();

#include "foo.h"
#include <string>
using namespace std;

void foo() { 
    string s("42");

To trigger the false positive:
clang++ -frewrite-includes -Wheader-hygiene -E foo.cc > tmp.cc
clang++ -frewrite-includes -Wheader-hygiene -c tmp.cc

This output is shown:
In file included from tmp.cc:1:
In file included from <built-in>:1:
foo.cc:3:17: warning: using namespace directive in global context in header
using namespace std;
1 warning generated.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140224/6593d9ed/attachment.html>

More information about the llvm-bugs mailing list