diff options
Diffstat (limited to 'test/SemaTemplate/dependent-names.cpp')
-rw-r--r-- | test/SemaTemplate/dependent-names.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/SemaTemplate/dependent-names.cpp b/test/SemaTemplate/dependent-names.cpp index efa4d28..eb75e69 100644 --- a/test/SemaTemplate/dependent-names.cpp +++ b/test/SemaTemplate/dependent-names.cpp @@ -346,3 +346,26 @@ namespace rdar12629723 { virtual void foo() { } }; } + +namespace test_reserved_identifiers { + template<typename A, typename B> void tempf(A a, B b) { + a + b; // expected-error{{call to function 'operator+' that is neither visible in the template definition nor found by argument-dependent lookup}} + } + namespace __gnu_cxx { struct X {}; } + namespace ns { struct Y {}; } + void operator+(__gnu_cxx::X, ns::Y); // expected-note{{or in namespace 'test_reserved_identifiers::ns'}} + void test() { + __gnu_cxx::X x; + ns::Y y; + tempf(x, y); // expected-note{{in instantiation of}} + } +} + +// This test must live in the global namespace. +struct PR14695_X {}; +// FIXME: This note is bogus; it is the using directive which would need to move +// to prior to the call site to fix the problem. +namespace PR14695_A { void PR14695_f(PR14695_X); } // expected-note {{'PR14695_f' should be declared prior to the call site or in the global namespace}} +template<typename T> void PR14695_g(T t) { PR14695_f(t); } // expected-error {{call to function 'PR14695_f' that is neither visible in the template definition nor found by argument-dependent lookup}} +using namespace PR14695_A; +template void PR14695_g(PR14695_X); // expected-note{{requested here}} |