1 | // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s |
2 | |
3 | // libstdc++ 4.6.x contains a bug where it defines std::__atomic[0,1,2] as a |
4 | // non-inline namespace, then selects one of those namespaces and reopens it |
5 | // as inline, as a strange way of providing something like a using-directive. |
6 | // Clang has an egregious hack to work around the problem, by allowing a |
7 | // namespace to be converted from non-inline to inline in this one specific |
8 | // case. |
9 | |
10 | #ifdef BE_THE_HEADER |
11 | |
12 | #pragma clang system_header |
13 | |
14 | namespace std { |
15 | namespace __atomic0 { |
16 | typedef int foobar; |
17 | } |
18 | namespace __atomic1 { |
19 | typedef void foobar; |
20 | } |
21 | |
22 | inline namespace __atomic0 {} |
23 | } |
24 | |
25 | #else |
26 | |
27 | #define BE_THE_HEADER |
28 | #include "libstdcxx_atomic_ns_hack.cpp" |
29 | |
30 | std::foobar fb; |
31 | |
32 | using T = void; // expected-note {{here}} |
33 | using T = std::foobar; // expected-error {{different types ('std::foobar' (aka 'int') vs 'void')}} |
34 | |
35 | #endif |
36 | |