more files
This commit is contained in:
61
src/test002.cpp
Executable file
61
src/test002.cpp
Executable file
@@ -0,0 +1,61 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class TemplateWithWarning {
|
||||||
|
public:
|
||||||
|
TemplateWithWarning(uint8_t number) { internalNumber = number; }
|
||||||
|
|
||||||
|
TemplateWithWarning(uint8_t number, bool someFlag)
|
||||||
|
: TemplateWithWarning(number) {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
uint32_t internalNumber;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ClassWithWarning {
|
||||||
|
public:
|
||||||
|
ClassWithWarning(char *name) { this->initClass(name); }
|
||||||
|
|
||||||
|
ClassWithWarning(uint8_t blarg) : ClassWithWarning("something") {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
char *name;
|
||||||
|
void initClass(char *name) { this->name = name; }
|
||||||
|
};
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
TemplateWithWarning<uint8_t> blarg(5, true);
|
||||||
|
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
template <typename T>
|
||||||
|
class A {
|
||||||
|
virtual void f() {}
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual ~A() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class B : public A<T> {
|
||||||
|
virtual void f() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void waldo() {
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class Color { Red, Green };
|
||||||
|
|
||||||
|
template <Color COL>
|
||||||
|
class Test {
|
||||||
|
public:
|
||||||
|
// The id could be changed only for red color.
|
||||||
|
typename std::enable_if<COL == Color::Red>::type setId(int id) { mId = id; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
int mId = 0;
|
||||||
|
};
|
||||||
63
src/test003.cpp
Executable file
63
src/test003.cpp
Executable file
@@ -0,0 +1,63 @@
|
|||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class TemplateWithWarning {
|
||||||
|
public:
|
||||||
|
TemplateWithWarning(int number) { internalNumber = number; }
|
||||||
|
|
||||||
|
TemplateWithWarning(int number, bool someFlag)
|
||||||
|
: TemplateWithWarning(number) {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int internalNumber;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TemplateWithWarning1 {
|
||||||
|
public:
|
||||||
|
TemplateWithWarning1(int number) { internalNumber = number; }
|
||||||
|
|
||||||
|
TemplateWithWarning1(int number, bool someFlag)
|
||||||
|
: TemplateWithWarning1(number) {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int internalNumber;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ClassWithWarning {
|
||||||
|
public:
|
||||||
|
ClassWithWarning(char *n) { this->initClass(n); }
|
||||||
|
|
||||||
|
ClassWithWarning(int k) { initClass("hi"); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
char *name;
|
||||||
|
void initClass(char *name) { this->name = name; }
|
||||||
|
};
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference;
|
||||||
|
|
||||||
|
IBinding fBinding = null;
|
||||||
|
if (fNameExp instanceof IASTIdExpression) {
|
||||||
|
IASTIdExpression fName = (IASTIdExpression)fNameExp;
|
||||||
|
fBinding = fName.getName().resolveBinding();
|
||||||
|
} else if (fNameExp instanceof ICPPASTFieldReference) {
|
||||||
|
ICPPASTFieldReference fName = (ICPPASTFieldReference)fNameExp;
|
||||||
|
fBinding = fName.getFieldName().resolveBinding();
|
||||||
|
}
|
||||||
|
if (fBinding != null) {
|
||||||
|
// class ClassWithWarning {
|
||||||
|
// public:
|
||||||
|
// ClassWithWarning(char* n) {
|
||||||
|
// this->initClass(n);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private:
|
||||||
|
// char *name;
|
||||||
|
// void initClass(char *name) {
|
||||||
|
// this->name = name;
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
public
|
||||||
|
void testMemberFunctionCalling_519473() throws Exception {
|
||||||
|
loadCodeAndRun(getAboveComment());
|
||||||
|
checkNoErrors();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user