[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / nullability_redecl.cpp
blob99bc521b89c13cc8dc7bd262bad41c5da040c15e
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wno-nullability-declspec %s -verify -Wnullable-to-nonnull-conversion -I%S/Inputs
3 class Foo;
4 using Foo1 = Foo _Nonnull; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'Foo'}}
5 class _Nullable Foo;
6 using Foo2 = Foo _Nonnull;
7 class Foo;
8 using Foo3 = Foo _Nonnull;
10 template <class T>
11 class Bar;
12 using Bar1 = Bar<int> _Nonnull; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'Bar<int>'}}
13 template <class T>
14 class _Nullable Bar;
15 using Bar2 = Bar<int> _Nonnull;
16 template <class T>
17 class Bar;
18 using Bar3 = Bar<int> _Nonnull;
20 namespace std {
21 template<class T> class unique_ptr;
22 using UP1 = unique_ptr<int> _Nonnull;
23 class X { template<class T> friend class unique_ptr; };
24 using UP2 = unique_ptr<int> _Nonnull;
25 template<class T> class unique_ptr;
26 using UP3 = unique_ptr<int> _Nonnull;