summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2012-12-06 18:51:14 (EST)
committerSergey Prigogin2012-12-06 18:54:26 (EST)
commitf2d8b90495f81fa69c619904169263ff0cacc484 (patch)
tree7dd0294ad23513ee76b15441733748984aaa4d0a
parent22c8d75b1a719f0fa9ed7b8a8612087f4b95eae7 (diff)
downloadorg.eclipse.cdt-f2d8b90495f81fa69c619904169263ff0cacc484.zip
org.eclipse.cdt-f2d8b90495f81fa69c619904169263ff0cacc484.tar.gz
org.eclipse.cdt-f2d8b90495f81fa69c619904169263ff0cacc484.tar.bz2
Bug 395247 - Error involving variadic constructorrefs/changes/61/9061/3
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. */