Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,23 @@ public void testImplicitConstructors_360223() throws Exception {
assertTrue(ctor instanceof ICPPConstructor);
}

// struct Foo { template <typename T> Foo() {} };
// template <typename T, typename U>
// struct Bar { constexpr static int val = 99; };
// template <typename T>
// struct Bar<T, decltype(T())> { };
// constexpr int v = Bar<Foo,Foo>::val;
public void testImplicitConstructors_1265() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), CPP);
NameCollector collector = new NameCollector(true);
tu.accept(collector);

assertEquals(collector.size(), 19);

ICPPVariable v = (ICPPVariable) collector.getName(18).resolveBinding();
assertEquals(99, v.getInitialValue().numberValue().intValue());
}

// struct A {
// A(int);
// };
Expand Down Expand Up @@ -1618,6 +1635,7 @@ public void testExplicitCopyConstructor_183160() throws Exception {
// class J {private: J(const J *, int j, int k=3);}; // J * rather than J &
// class K {protected: K(volatile K *, int i=4, int l=2);}; // K * rather than K &
// class L {L(const volatile L &, int i=1, long k=2, int* x) {}}; // param int* x has no initializer
// class M {public: template <typename T> M(){}}; // same signature as implicit
public void testNotExplicitCopyConstructor_183160() throws Exception {
BufferedReader br = new BufferedReader(new StringReader(getAboveComment()));
for (String line = br.readLine(); line != null; line = br.readLine()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
Expand Down Expand Up @@ -86,6 +87,8 @@ private void analyzeMembers(ICPPASTCompositeTypeSpecifier compositeTypeSpecifier
IASTDeclaration[] members = compositeTypeSpecifier.getMembers();
char[] name = compositeTypeSpecifier.getName().getLookupKey();
for (IASTDeclaration member : members) {
if (member instanceof ICPPASTTemplateDeclaration)
member = ((ICPPASTTemplateDeclaration) member).getDeclaration();
IASTDeclarator dcltor = null;
IASTDeclSpecifier spec = null;
if (member instanceof IASTSimpleDeclaration) {
Expand Down
Loading