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 z((Base){.t = 2}); 27 // 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 28 // 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 29 // 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 30 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:26:13 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC2 %s 31 // CHECK-CC2: COMPLETION: t : [#int#]t 32 } 33 34 // Handle templates 35 template <typename T> 36 struct Test { T x; }; 37 template <> 38 struct Test<int> { 39 int x; 40 char y; 41 }; 42 void bar() { 43 Test<char> T{.x = 2}; 44 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:43:17 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC3 %s 45 // CHECK-CC3: COMPLETION: x : [#T#]x 46 Test<int> X{.x = 2}; 47 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:46:16 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC4 %s 48 // CHECK-CC4: COMPLETION: x : [#int#]x 49 // CHECK-CC4-NEXT: COMPLETION: y : [#char#]y 50 } 51 52 template <typename T> 53 void aux() { 54 Test<T> X{.x = T(2)}; 55 // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:54:14 %s -o - -std=c++2a | FileCheck -check-prefix=CHECK-CC3 %s 56 } 57