blob: a382ccfa6cd2b80b03067160d14940e9e60cd195 [file] [log] [blame]
George Burgess IV3cde9bf2016-03-19 21:36:10 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++14
2
3namespace access_control {
4class Private {
5 void check(int *) __attribute__((enable_if(false, "")));
6 void check(double *) __attribute__((enable_if(true, "")));
7
8 static void checkStatic(int *) __attribute__((enable_if(false, "")));
9 static void checkStatic(double *) __attribute__((enable_if(true, "")));
10};
11
12auto Priv = reinterpret_cast<void (Private::*)(char *)>(&Private::check); // expected-error{{'check' is a private member of 'access_control::Private'}} expected-note@6{{implicitly declared private here}}
13
14auto PrivStatic = reinterpret_cast<void (*)(char *)>(&Private::checkStatic); // expected-error{{'checkStatic' is a private member of 'access_control::Private'}} expected-note@9{{implicitly declared private here}}
15
16class Protected {
17protected:
18 void check(int *) __attribute__((enable_if(false, "")));
19 void check(double *) __attribute__((enable_if(true, "")));
20
21 static void checkStatic(int *) __attribute__((enable_if(false, "")));
22 static void checkStatic(double *) __attribute__((enable_if(true, "")));
23};
24
25auto Prot = reinterpret_cast<void (Protected::*)(char *)>(&Protected::check); // expected-error{{'check' is a protected member of 'access_control::Protected'}} expected-note@19{{declared protected here}}
26
27auto ProtStatic = reinterpret_cast<void (*)(char *)>(&Protected::checkStatic); // expected-error{{'checkStatic' is a protected member of 'access_control::Protected'}} expected-note@22{{declared protected here}}
28}
29
30namespace unavailable {
31// Ensure that we check that the function can be called
32void foo() __attribute__((unavailable("don't call this")));
33void foo(int) __attribute__((enable_if(false, "")));
34
35void *Ptr = reinterpret_cast<void*>(foo); // expected-error{{'foo' is unavailable: don't call this}} expected-note@-3{{explicitly marked unavailable here}}
36}