summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2012-12-06 18:51:14 (EST)
committerSergey Prigogin2012-12-07 15:02:04 (EST)
commitbb97b889b255fe35d40995726ff87f1d0f0a4f6c (patch)
treee3a03880203ac6504973037dd6288c326da047f8
parent66bb47cde05056696b6c31d46949f13e6f914804 (diff)
downloadorg.eclipse.cdt-bb97b889b255fe35d40995726ff87f1d0f0a4f6c.zip
org.eclipse.cdt-bb97b889b255fe35d40995726ff87f1d0f0a4f6c.tar.gz
org.eclipse.cdt-bb97b889b255fe35d40995726ff87f1d0f0a4f6c.tar.bz2
Bug 395247 - Error involving variadic constructor
Change-Id: Ia5f911e0a80a5372943a505b814c333c53a5a602 Reviewed-on: https://git.eclipse.org/r/9061 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java14
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java2
3 files changed, 17 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
index e07b132..868304d 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
@@ -6897,7 +6897,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// struct Cat {};
// typedef S<is_convertible<Cat>::value>::type T;
public void testDependentExpressionInvolvingField_388623() throws Exception {
- parseAndCheckBindings(getAboveComment(), CPP, true);
+ parseAndCheckBindings();
}
// struct S {
@@ -6911,4 +6911,16 @@ public class AST2TemplateTests extends AST2BaseTest {
public void testSFINAEInDefaultArgument() throws Exception {
parseAndCheckBindings();
}
+
+ // template <typename>
+ // struct M {
+ // template <typename... Args>
+ // M(Args...);
+ // };
+ // void foo() {
+ // new M<int>((int*)0, 0);
+ // }
+ public void testVariadicConstructor_395247() throws Exception {
+ parseAndCheckBindings();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
index dec5a06..eeb245d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
@@ -417,6 +417,9 @@ public class CPPSemantics {
if (cls instanceof ICPPUnknownBinding) {
binding= new CPPUnknownConstructor(cls);
} else {
+ // Do not interpret template arguments to a template class as being
+ // explicit template arguments to its templated constructor.
+ data.fTemplateArguments = null;
binding= CPPSemantics.resolveFunction(data, ClassTypeHelper.getConstructors(cls, lookupPoint), true);
}
} catch (DOMException e) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java
index bb46772..eb52bce 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java
@@ -79,7 +79,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
* Context data for IASTName lookup
*/
public class LookupData extends ScopeLookupData {
- final public ICPPTemplateArgument[] fTemplateArguments;
+ public ICPPTemplateArgument[] fTemplateArguments;
public Map<ICPPNamespaceScope, List<ICPPNamespaceScope>> usingDirectives= Collections.emptyMap();
/** Used to ensure we don't visit things more than once. */