mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug 511143 - Const qualifier confuses __is_class built-in type trait
Change-Id: Iff01dd7e7fe6a4fec0b783275d7a5d4babd07d25
This commit is contained in:
parent
704dc4a53f
commit
8dd3aa2e3b
2 changed files with 22 additions and 0 deletions
|
@ -4133,6 +4133,23 @@ public class AST2TemplateTests extends AST2TestBase {
|
||||||
assertEquals("string", ASTTypeUtil.getType(s.getType(), false));
|
assertEquals("string", ASTTypeUtil.getType(s.getType(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template<typename T, bool b = __is_class(T)>
|
||||||
|
// class A {};
|
||||||
|
//
|
||||||
|
// template<typename T>
|
||||||
|
// class A<T, true> {
|
||||||
|
// void waldo();
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// class B {};
|
||||||
|
//
|
||||||
|
// void test(A<const B> p) {
|
||||||
|
// p.waldo();
|
||||||
|
// }
|
||||||
|
public void testTypeTraitWithQualifier_511143() throws Exception {
|
||||||
|
parseAndCheckBindings(getAboveComment(), CPP, true);
|
||||||
|
}
|
||||||
|
|
||||||
// template <typename CL, typename T>
|
// template <typename CL, typename T>
|
||||||
// struct A {
|
// struct A {
|
||||||
// template<typename U> struct C {
|
// template<typename U> struct C {
|
||||||
|
|
|
@ -51,6 +51,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IQualifierType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
|
@ -387,6 +388,10 @@ public class ValueFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IValue applyUnaryTypeIdOperator(int operator, IType type, IASTNode point) {
|
private static IValue applyUnaryTypeIdOperator(int operator, IType type, IASTNode point) {
|
||||||
|
while (type instanceof IQualifierType) {
|
||||||
|
type = ((IQualifierType) type).getType();
|
||||||
|
}
|
||||||
|
|
||||||
switch (operator) {
|
switch (operator) {
|
||||||
case op_sizeof:
|
case op_sizeof:
|
||||||
return getSize(type, point);
|
return getSize(type, point);
|
||||||
|
|
Loading…
Add table
Reference in a new issue