brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · bf8df1a Raw
78 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s3// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s4 5// rdar46414036namespace N {7  struct X { // expected-note{{candidate found by name lookup}}8    float b;9  };10}11 12using namespace N;13 14typedef struct {15  int a;16} X; // expected-note{{candidate found by name lookup}}17 18 19struct Y { };20void Y(int) { }21 22void f() {23  X *x; // expected-error{{reference to 'X' is ambiguous}}24  Y(1); // okay25}26 27namespace PR17731 {28  void f() {29    struct S { S() {} };30    int S(void);31    int a = S();32    struct S b;33    {34      int S(void);35      int a = S();36      struct S c = b;37    }38    {39      struct S { S() {} }; // expected-note {{candidate constructor (the implicit copy constructor) not viable}}40#if __cplusplus >= 201103L // C++11 or later41      // expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}}42#endif43      int a = S(); // expected-error {{no viable conversion from 'S'}}44      struct S c = b; // expected-error {{no viable conversion from 'struct S'}}45    }46  }47  void g() {48    int S(void);49    struct S { S() {} };50    int a = S();51    struct S b;52    {53      int S(void);54      int a = S();55      struct S c = b;56    }57    {58      struct S { S() {} }; // expected-note {{candidate constructor (the implicit copy constructor) not viable}}59#if __cplusplus >= 201103L // C++11 or later60      // expected-note@-2 {{candidate constructor (the implicit move constructor) not viable}}61#endif62      int a = S(); // expected-error {{no viable conversion from 'S'}}63      struct S c = b; // expected-error {{no viable conversion from 'struct S'}}64    }65  }66 67  struct A {68    struct B;69    void f();70    int B;71  };72  struct A::B {};73  void A::f() {74    B = 123;75    struct B b;76  }77}78