mirror of https://github.com/roytam1/UXP
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
2.3 KiB
41 lines
2.3 KiB
#define MOZ_NON_AUTOABLE __attribute__((annotate("moz_non_autoable"))) |
|
|
|
template<class T> |
|
struct MOZ_NON_AUTOABLE ExplicitTypeTemplate {}; |
|
struct MOZ_NON_AUTOABLE ExplicitType {}; |
|
struct NonExplicitType {}; |
|
|
|
void f() { |
|
{ |
|
ExplicitType a; |
|
auto b = a; // expected-error {{Cannot use auto to declare a variable of type 'ExplicitType'}} expected-note {{Please write out this type explicitly}} |
|
auto &br = a; // expected-error {{Cannot use auto to declare a variable of type 'ExplicitType &'}} expected-note {{Please write out this type explicitly}} |
|
const auto &brc = a; // expected-error {{Cannot use auto to declare a variable of type 'const ExplicitType &'}} expected-note {{Please write out this type explicitly}} |
|
auto *bp = &a; // expected-error {{Cannot use auto to declare a variable of type 'ExplicitType *'}} expected-note {{Please write out this type explicitly}} |
|
const auto *bpc = &a; // expected-error {{Cannot use auto to declare a variable of type 'const ExplicitType *'}} expected-note {{Please write out this type explicitly}} |
|
} |
|
|
|
{ |
|
ExplicitTypeTemplate<int> a; |
|
auto b = a; // expected-error {{Cannot use auto to declare a variable of type 'ExplicitTypeTemplate<int>'}} expected-note {{Please write out this type explicitly}} |
|
auto &br = a; // expected-error {{Cannot use auto to declare a variable of type 'ExplicitTypeTemplate<int> &'}} expected-note {{Please write out this type explicitly}} |
|
const auto &brc = a; // expected-error {{Cannot use auto to declare a variable of type 'const ExplicitTypeTemplate<int> &'}} expected-note {{Please write out this type explicitly}} |
|
auto *bp = &a; // expected-error {{Cannot use auto to declare a variable of type 'ExplicitTypeTemplate<int> *'}} expected-note {{Please write out this type explicitly}} |
|
const auto *bpc = &a; // expected-error {{Cannot use auto to declare a variable of type 'const ExplicitTypeTemplate<int> *'}} expected-note {{Please write out this type explicitly}} |
|
} |
|
|
|
{ |
|
NonExplicitType c; |
|
auto d = c; |
|
auto &dr = c; |
|
const auto &drc = c; |
|
auto *dp = &c; |
|
const auto *dpc = &c; |
|
} |
|
} |
|
|
|
ExplicitType A; |
|
auto B = A; // expected-error {{Cannot use auto to declare a variable of type 'ExplicitType'}} expected-note {{Please write out this type explicitly}} |
|
|
|
NonExplicitType C; |
|
auto D = C;
|
|
|