aboutsummaryrefslogtreecommitdiff
path: root/test/FixIt/typo.cpp
blob: e0c7bf64dc63facf829709e3f044b6c5770d82ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -fixit -o - | %clang_cc1 -fsyntax-only -pedantic -Werror -x c++ -
namespace std {
  template<typename T> class basic_string { 
    int find(const char *substr);
    static const int npos = -1;
  };

  typedef basic_string<char> string;
}

namespace otherstd {
  using namespace std;
}

using namespace std;

otherstd::strng str1; // expected-error{{no type named 'strng' in namespace 'otherstd'; did you mean 'string'?}}
tring str2; // expected-error{{unknown type name 'tring'; did you mean 'string'?}}

float area(float radius, float pi) {
  return radious * pi; // expected-error{{use of undeclared identifier 'radious'; did you mean 'radius'?}}
}

bool test_string(std::string s) {
  return s.fnd("hello") // expected-error{{no member named 'fnd' in 'class std::basic_string<char>'; did you mean 'find'?}}
    == std::string::pos; // expected-error{{no member named 'pos' in 'class std::basic_string<char>'; did you mean 'npos'?}}
}