Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferguson2008-05-23 18:19:02 +0000
committerAndrew Ferguson2008-05-23 18:19:02 +0000
commit688df291ee88d1acd640f602bd84a49546265e6b (patch)
treeb48f6a28f297dbe1edcacb9d7977b6b3ec045267
parent4caaf836f61b6b03fce00c784d949390c3a8e0f6 (diff)
downloadorg.eclipse.cdt-688df291ee88d1acd640f602bd84a49546265e6b.tar.gz
org.eclipse.cdt-688df291ee88d1acd640f602bd84a49546265e6b.tar.xz
org.eclipse.cdt-688df291ee88d1acd640f602bd84a49546265e6b.zip
207871: add testcase
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java
index 2c68729385b..55f098c5aac 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java
@@ -18,6 +18,7 @@ import junit.framework.TestSuite;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
@@ -1264,4 +1265,36 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
assertTrue(type instanceof IBasicType);
assertEquals(((IBasicType)type).getType(), IBasicType.t_int);
}
+
+ // template <int x>
+ // class C {
+ // public:
+ // inline C() {};
+ // };
+ //
+ // const int _256=0x100;
+ //
+ // typedef C<_256> aRef;
+ //
+ // void foo(aRef& aRefence) {}
+ // void bar(C<_256>& aRefence) {}
+ // void baz(void) {}
+
+ // int main (void) {
+ // C<256> t;
+ // foo(t);
+ // bar(t);
+ // baz();
+ // }
+ public void _testClassInstanceWithNonTypeArgument_207871() throws Exception {
+ ICPPTemplateInstance c256 = getBindingFromASTName("C<256>", 6, ICPPTemplateInstance.class, ICPPClassType.class);
+ ObjectMap args= c256.getArgumentMap();
+ assertEquals(1, args.size());
+ assertInstance(args.keyAt(0), ICPPTemplateNonTypeParameter.class);
+ ICPPBasicType bt= assertInstance(args.getAt(0), ICPPBasicType.class);
+ IASTExpression val= bt.getValue();
+
+ ICPPFunction foo = getBindingFromASTName("foo(t)", 3, ICPPFunction.class);
+ ICPPFunction bar = getBindingFromASTName("bar(t)", 3, ICPPFunction.class);
+ }
}

Back to the top