[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)
[llvm-project.git] / clang / test / Sema / typo-correction-no-hang.cpp
blob3c591645be25cbb187b18f52ba85cc81d5555a98
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 // From `test/Sema/typo-correction.c` but for C++ since the behavior varies
4 // between the two languages.
5 struct rdar38642201 {
6 int fieldName;
7 };
9 void rdar38642201_callee(int x, int y);
10 void rdar38642201_caller() {
11 struct rdar38642201 structVar;
12 rdar38642201_callee(
13 structVar1.fieldName1.member1, //expected-error{{use of undeclared identifier 'structVar1'}}
14 structVar2.fieldName2.member2); //expected-error{{use of undeclared identifier 'structVar2'}}
17 // Similar reproducer.
18 class A {
19 public:
20 int minut() const = delete;
21 int hour() const = delete;
23 int longit() const; //expected-note{{'longit' declared here}}
24 int latit() const;
27 class B {
28 public:
29 A depar() const { return A(); }
32 int Foo(const B &b) {
33 return b.deparT().hours() * 60 + //expected-error{{no member named 'deparT' in 'B'}}
34 b.deparT().minutes(); //expected-error{{no member named 'deparT' in 'B'}}
37 int Bar(const B &b) {
38 return b.depar().longitude() + //expected-error{{no member named 'longitude' in 'A'; did you mean 'longit'?}}
39 b.depar().latitude(); //expected-error{{no member named 'latitude' in 'A'}}