1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s 2*f4a2713aSLionel Sambuc // RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s 3*f4a2713aSLionel Sambuc // RUN: cp %s %t 4*f4a2713aSLionel Sambuc // RUN: not %clang_cc1 -fsyntax-only -fixit -x c %t 5*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -pedantic -Werror -x c %t 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambuc struct Point { 8*f4a2713aSLionel Sambuc float x, y; 9*f4a2713aSLionel Sambuc }; 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc struct Rectangle { 12*f4a2713aSLionel Sambuc struct Point top_left, // expected-note{{'top_left' declared here}} 13*f4a2713aSLionel Sambuc bottom_right; 14*f4a2713aSLionel Sambuc }; 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc enum Color { Red, Green, Blue }; 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc struct Window { 19*f4a2713aSLionel Sambuc struct Rectangle bounds; // expected-note{{'bounds' declared here}} 20*f4a2713aSLionel Sambuc enum Color color; 21*f4a2713aSLionel Sambuc }; 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc struct Window window = { 24*f4a2713aSLionel Sambuc .bunds. // expected-error{{field designator 'bunds' does not refer to any field in type 'struct Window'; did you mean 'bounds'?}} 25*f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:4-[[@LINE-1]]:9}:"bounds" 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc topleft.x = 3.14, // expected-error{{field designator 'topleft' does not refer to any field in type 'struct Rectangle'; did you mean 'top_left'?}} 28*f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:10}:"top_left" 29*f4a2713aSLionel Sambuc 2.71818, 5.0, 6.0, Red 30*f4a2713aSLionel Sambuc }; 31*f4a2713aSLionel Sambuc test()32*f4a2713aSLionel Sambucvoid test() { 33*f4a2713aSLionel Sambuc Rectangle r1; // expected-error{{must use 'struct' tag to refer to type 'Rectangle'}} 34*f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:3}:"struct " 35*f4a2713aSLionel Sambuc r1.top_left.x = 0; 36*f4a2713aSLionel Sambuc 37*f4a2713aSLionel Sambuc typedef struct Rectangle Rectangle; // expected-note{{'Rectangle' declared here}} 38*f4a2713aSLionel Sambuc rectangle *r2 = &r1; // expected-error{{unknown type name 'rectangle'; did you mean 'Rectangle'?}} 39*f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:12}:"Rectangle" 40*f4a2713aSLionel Sambuc 41*f4a2713aSLionel Sambuc r2->top_left.y = 0; 42*f4a2713aSLionel Sambuc unsinged *ptr = 0; // expected-error{{use of undeclared identifier 'unsinged'; did you mean 'unsigned'?}} 43*f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:11}:"unsigned" 44*f4a2713aSLionel Sambuc *ptr = 17; 45*f4a2713aSLionel Sambuc } 46