| George Burgess IV | 3cde9bf | 2016-03-19 21:36:10 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++14 |
| 2 | |
| 3 | namespace access_control { |
| 4 | class 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 | |
| 12 | auto 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 | |
| 14 | auto 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 | |
| 16 | class Protected { |
| 17 | protected: |
| 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 | |
| 25 | auto 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 | |
| 27 | auto 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 | |
| 30 | namespace unavailable { |
| 31 | // Ensure that we check that the function can be called |
| 32 | void foo() __attribute__((unavailable("don't call this"))); |
| 33 | void foo(int) __attribute__((enable_if(false, ""))); |
| 34 | |
| 35 | void *Ptr = reinterpret_cast<void*>(foo); // expected-error{{'foo' is unavailable: don't call this}} expected-note@-3{{explicitly marked unavailable here}} |
| 36 | } |