mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 395026 - Fixed the second use case.
This commit is contained in:
parent
7d0f0c8ecf
commit
f6b4b3dae2
2 changed files with 56 additions and 4 deletions
|
@ -6726,7 +6726,52 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
// void test(E<A<int>>::type v) {
|
// void test(E<A<int>>::type v) {
|
||||||
// f(v);
|
// f(v);
|
||||||
// }
|
// }
|
||||||
public void testAliasTemplate_395026() throws Exception {
|
public void testAliasTemplate_395026_1() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
// template<typename U>
|
||||||
|
// struct A {
|
||||||
|
// template<typename V>
|
||||||
|
// struct rebind {
|
||||||
|
// typedef A<V> other;
|
||||||
|
// };
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template<typename T, typename U>
|
||||||
|
// struct B {
|
||||||
|
// typedef typename T::template rebind<U>::other type1;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template<typename T>
|
||||||
|
// struct C {
|
||||||
|
// template<typename U>
|
||||||
|
// using rebind2 = typename B<T, U>::type1;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template<typename T>
|
||||||
|
// struct D : C<T> {
|
||||||
|
// typedef int* type0;
|
||||||
|
// template<typename U>
|
||||||
|
// struct rebind {
|
||||||
|
// typedef typename C<T>::template rebind2<U> other;
|
||||||
|
// };
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template<typename U>
|
||||||
|
// struct E {
|
||||||
|
// typedef typename D<A<U>>::template rebind<U>::other type2;
|
||||||
|
// typedef typename D<type2>::type0 type;
|
||||||
|
// type operator[](int n);
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// void f(int);
|
||||||
|
//
|
||||||
|
// void test() {
|
||||||
|
// E<int*> v;
|
||||||
|
// f(*v[0]);
|
||||||
|
// }
|
||||||
|
public void testAliasTemplate_395026_2() throws Exception {
|
||||||
parseAndCheckBindings();
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Thomas Corbat (IFS) - Initial API and implementation
|
* Thomas Corbat (IFS) - Initial API and implementation
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -22,21 +23,22 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplateInstance;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||||
import org.eclipse.cdt.internal.core.dom.Linkage;
|
import org.eclipse.cdt.internal.core.dom.Linkage;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableType;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableType;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.PlatformObject;
|
import org.eclipse.core.runtime.PlatformObject;
|
||||||
|
|
||||||
public class CPPAliasTemplateInstance extends PlatformObject
|
public class CPPAliasTemplateInstance extends PlatformObject
|
||||||
implements ICPPAliasTemplateInstance, ISerializableType {
|
implements ICPPAliasTemplateInstance, ITypeContainer, ISerializableType {
|
||||||
private final char[] name;
|
private final char[] name;
|
||||||
private final IType aliasedType;
|
|
||||||
private final ICPPAliasTemplate aliasTemplate;
|
private final ICPPAliasTemplate aliasTemplate;
|
||||||
|
private IType aliasedType;
|
||||||
|
|
||||||
public CPPAliasTemplateInstance(char[] name, IType aliasedType, ICPPAliasTemplate aliasTemplate) {
|
public CPPAliasTemplateInstance(char[] name, IType aliasedType, ICPPAliasTemplate aliasTemplate) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.aliasedType = aliasedType;
|
|
||||||
this.aliasTemplate = aliasTemplate;
|
this.aliasTemplate = aliasTemplate;
|
||||||
|
this.aliasedType = aliasedType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -59,6 +61,11 @@ public class CPPAliasTemplateInstance extends PlatformObject
|
||||||
return aliasedType;
|
return aliasedType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setType(IType type) {
|
||||||
|
aliasedType = type;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue