[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


http://llvm.org/bugs/show_bug.cgi?id=18948

            Bug ID: 18948
           Summary: -frewrite-includes causes -Wheader-hygiene false
                    positives
           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:

foo.h:
void foo();

foo.cc:
#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
[-Wheader-hygiene]
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