mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-04 07:35:24 +02:00
Bug 408303 - [C++11] Incorrect member not initialized warnings for
template class's defaulted constructors Change-Id: I61064421c2cee405c9a915abe500c94fa4423eef Signed-off-by: Nathan Ridge <zeratul976@hotmail.com> Reviewed-on: https://git.eclipse.org/r/14177 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
parent
01b1f9a14a
commit
884f6e2044
2 changed files with 19 additions and 1 deletions
|
@ -590,6 +590,8 @@ public class ClassMembersInitializationCheckerTest extends CheckerTestCase {
|
|||
}
|
||||
|
||||
// struct S {
|
||||
// int i;
|
||||
//
|
||||
// S(S&) = default;
|
||||
// S(const S&) = default;
|
||||
// S(volatile S&) = default;
|
||||
|
@ -604,6 +606,18 @@ public class ClassMembersInitializationCheckerTest extends CheckerTestCase {
|
|||
checkNoErrors();
|
||||
}
|
||||
|
||||
// template <typename T>
|
||||
// struct S {
|
||||
// int i;
|
||||
//
|
||||
// S(const S&) = default;
|
||||
// S(S&&) = default;
|
||||
// };
|
||||
public void testBug408303_defaultCopyOrMoveConstructorInTemplate() throws Exception {
|
||||
loadCodeAndRun(getAboveComment());
|
||||
checkNoErrors();
|
||||
}
|
||||
|
||||
// struct A {
|
||||
// A(int n) : waldo(n) {}
|
||||
// A() : A(42) {}
|
||||
|
|
|
@ -14,6 +14,7 @@ import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUti
|
|||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
|
||||
|
||||
/**
|
||||
|
@ -57,7 +58,10 @@ public class SemanticQueries {
|
|||
return false;
|
||||
firstArgumentType = firstArgReferenceType.getType();
|
||||
firstArgumentType = SemanticUtil.getNestedType(firstArgumentType, CVTYPE);
|
||||
return firstArgumentType.isSameType(constructor.getClassOwner());
|
||||
ICPPClassType classType = constructor.getClassOwner();
|
||||
if (classType instanceof ICPPClassTemplate)
|
||||
classType = CPPTemplates.createDeferredInstance((ICPPClassTemplate) classType);
|
||||
return firstArgumentType.isSameType(classType);
|
||||
}
|
||||
|
||||
private static boolean isCallableWithNumberOfArguments(ICPPFunction function, int numArguments) {
|
||||
|
|
Loading…
Add table
Reference in a new issue