brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 76d27ce Raw
62 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3class M {4  int iM;5};6 7class P {8  int iP; // expected-note {{declared private here}}9  int PPR(); // expected-note {{declared private here}}10};11 12class N : M,P {13  N() {}14  int PR() { return iP + PPR(); } // expected-error 2 {{private member of 'P'}}15};16 17namespace GH83608 {18 19class single;20 21class check_constructible {22  // This makes the class a non-aggregate, which enforces us to check23  // the constructor when initializing.24  check_constructible() {}25 26  friend class single;27};28 29struct single {30  template <class T> single(T u, check_constructible = {}) {}31};32 33// We perform access checking when substituting into the default argument.34// Make sure it runs within the context of 'single'.35single x(0);36 37}38 39namespace GH62444 {40 41struct B {42  friend struct A;43private:44  B(int); // #B45};46 47template<class T>48int f(T = 0); // #Decl49 50struct A {51  A() {52    int i = f<B>();53    // expected-error@#Decl {{calling a private constructor}}54    // expected-note@-2 {{in instantiation of default function argument}}55    // expected-note@#B {{declared private}}56  }57};58 59int i = f<B>();60 61}62