1 struct Base { 2 int t; 3 }; 4 struct Foo : public Base { 5 int x; 6 Base b; 7 void foo(); 8 }; 9 10 void foo() { 11 Foo F{.x = 2, .b.t = 0}; 12 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:11:10 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC1 %s 13 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:11:18 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC1 %s 14 // CHECK-CC1: COMPLETION: b : [#Base#]b 15 // CHECK-CC1-NEXT: COMPLETION: x : [#int#]x 16 // CHECK-CC1-NOT: foo 17 // CHECK-CC1-NOT: t 18 19 // FIXME: Handle nested designators 20 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:11:20 %s -o - | count 0 21 22 Base B = {.t = 2}; 23 auto z = [](Base B) {}; 24 z({.t = 1}); 25 z(Base{.t = 2}); 26 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:22:14 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s 27 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:24:7 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s 28 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:25:11 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s 29 // CHECK-CC2: COMPLETION: t : [#int#]t 30 } 31 32 // Handle templates 33 template <typename T> 34 struct Test { T x; }; 35 template <> 36 struct Test<int> { 37 int x; 38 char y; 39 }; 40 void bar() { 41 Test<char> T{.x = 2}; 42 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:41:17 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC3 %s 43 // CHECK-CC3: COMPLETION: x : [#T#]x 44 Test<int> X{.x = 2}; 45 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:44:16 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC4 %s 46 // CHECK-CC4: COMPLETION: x : [#int#]x 47 // CHECK-CC4-NEXT: COMPLETION: y : [#char#]y 48 } 49 50 template <typename T> 51 void aux() { 52 Test<T> X{.x = T(2)}; 53 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:52:14 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC3 %s 54 } 55