<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - -frewrite-includes causes -Wheader-hygiene false positives"
   href="http://llvm.org/bugs/show_bug.cgi?id=18948">18948</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-frewrite-includes causes -Wheader-hygiene false positives
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mostynb@opera.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>