| Summary: | Parser error when using decltype | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Nathan Ridge <zeratul976> |
| Component: | cdt-indexer | Assignee: | Sergey Prigogin <eclipse.sprigogin> |
| Status: | RESOLVED FIXED | QA Contact: | Markus Schorn <mschorn.eclipse> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug, eclipse.sprigogin, yevshif |
| Version: | 8.0 | ||
| Target Milestone: | 8.1.1 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Bug Depends on: | 299911 | ||
| Bug Blocks: | |||
I should note that if I copy-and-paste the contents of test.hpp into test.cpp in place of the #include, the error goes away. This is not the first time I've seen this behaviour, and I am very curious as to why it happens. Currently we cannot properly store dependent types involving decltype. I'm not sure whether this (and the bug it depends on) is planned to be fixed for 8.0, but if not, would it be possible to disable the generation of "Invalid arguments ..." error bindings for functions where the parser is unable to deduce to return type or argument types? I think users would rather the parser fail to report a few legitimate errors, than report errors for valid code. Fixed together with bug 299911. |
Here is test.hpp: template <typename T> class A {}; template <typename T> A<T> h(T); template <typename T> auto g(T t) -> decltype(h(t)); Here is test.cpp: #include "test.hpp" void f() { g(0); // ERROR HERE } The parser gives the following error: Invalid arguments ' Candidates are: ? g(#0) ' The code compiles fine with g++ >= 4.4