p2.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // RUN: %clang_cc1 -fsyntax-only -verify %s
  2. // rdar4641403
  3. namespace N {
  4. struct X { // expected-note{{candidate found by name lookup}}
  5. float b;
  6. };
  7. }
  8. using namespace N;
  9. typedef struct {
  10. int a;
  11. } X; // expected-note{{candidate found by name lookup}}
  12. struct Y { };
  13. void Y(int) { }
  14. void f() {
  15. X *x; // expected-error{{reference to 'X' is ambiguous}}
  16. Y(1); // okay
  17. }
  18. namespace PR17731 {
  19. void f() {
  20. struct S { S() {} };
  21. int S(void);
  22. int a = S();
  23. struct S b;
  24. {
  25. int S(void);
  26. int a = S();
  27. struct S c = b;
  28. }
  29. {
  30. struct S { S() {} }; // expected-note {{candidate}}
  31. int a = S(); // expected-error {{no viable conversion from 'S'}}
  32. struct S c = b; // expected-error {{no viable conversion from 'struct S'}}
  33. }
  34. }
  35. void g() {
  36. int S(void);
  37. struct S { S() {} };
  38. int a = S();
  39. struct S b;
  40. {
  41. int S(void);
  42. int a = S();
  43. struct S c = b;
  44. }
  45. {
  46. struct S { S() {} }; // expected-note {{candidate}}
  47. int a = S(); // expected-error {{no viable conversion from 'S'}}
  48. struct S c = b; // expected-error {{no viable conversion from 'struct S'}}
  49. }
  50. }
  51. struct A {
  52. struct B;
  53. void f();
  54. int B;
  55. };
  56. struct A::B {};
  57. void A::f() {
  58. B = 123;
  59. struct B b;
  60. }
  61. }