| Summary: | Template Argument Deduction throws AssertionErrors (Regression) | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Markus Schorn <mschorn.eclipse> |
| Component: | cdt-parser | Assignee: | Sergey Prigogin <eclipse.sprigogin> |
| Status: | RESOLVED FIXED | QA Contact: | Markus Schorn <mschorn.eclipse> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug, eclipse.sprigogin, mober.at+eclipse, zeratul976 |
| Version: | 8.2 | ||
| Target Milestone: | 8.1.2 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Markus Schorn
This may have been broken by one of my patches. I will look into it. How do you run the tests with -ea? So far the way I've run them is by right-clicking on a test suite (like DOMParserTestSuite) in Eclipse and selecting Run As -> JUnit Plug-in Test. Choose Run > Debug... to edit the Launch Configuration which was created by your "Run As..." action. On its "Arguments" tab under "VM Arguments" add "-ea" . I've pushed a proposed fix to https://git.eclipse.org/r/#/c/10165/. (In reply to comment #3) > I've pushed a proposed fix to https://git.eclipse.org/r/#/c/10165/. I think the following patch is sufficient to fix the problem: --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java @@ -622,7 +622,9 @@ public class TemplateArgumentDeduction { if (!deduct.fromTemplateArgument(pattern, a[i], point)) { return false; } - deduct.incPackOffset(); + if (i != a.length - 1) { + deduct.incPackOffset(); + } } break; } else { (In reply to comment #4) > (In reply to comment #3) > > I've pushed a proposed fix to https://git.eclipse.org/r/#/c/10165/. > > I think the following patch is sufficient to fix the problem: > > --- > a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ > cpp/semantics/TemplateArgumentDeduction.java > +++ > b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ > cpp/semantics/TemplateArgumentDeduction.java > @@ -622,7 +622,9 @@ public class TemplateArgumentDeduction { > if > (!deduct.fromTemplateArgument(pattern, a[i], point)) { > return false; > } > - deduct.incPackOffset(); > + if (i != a.length - 1) { > + deduct.incPackOffset(); > + } > } > break; > } else { This was my first idea, but I discarded it. Imagine for a second that due to some bug deduct.fromTemplateArgument is called again after "if (i != a.length - 1) { deduct.incPackOffset(); }". If we want the assertion to catch such situation, it should be moved from incPackOffset to fromTemplateArgument how it is done in https://git.eclipse.org/r/#/c/10165. Fixed by commit http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=8f2f79f4f286903e9fe668e06290a876eb976f07. *** cdt git genie on behalf of Sergey Prigogin ***
Bug 399592 - Template Argument Deduction throws AssertionErrors
Change-Id: I891a0ea21e54c2e0a4969a351b3366859525dcd4
Reviewed-on: <a href="https://git.eclipse.org/r/10165">https://git.eclipse.org/r/10165</a>
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx>
IP-Clean: Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx>
Tested-by: Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx>
[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=fd96243c704c11eda1627f4a7802ba0837956728
|