| Summary: | A function with a reference parameter is not resolved when the parameter is a return value from another function | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Gil Barash <scobido1984> |
| Component: | cdt-parser | Assignee: | Project Inbox <cdt-parser-inbox> |
| Status: | RESOLVED INVALID | QA Contact: | Markus Schorn <mschorn.eclipse> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug, malaperle |
| Version: | 8.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
Hmmm, it doesn't compile with gcc 4.5.2 ang clang 2.9 though. error: invalid initialization of non-const reference of type 'A&' from an rvalue of type 'A' error: in passing argument 1 of 'int foo(A&)' If you use /Za (disable language extensions) in VS you should get Error 2 error C2664: 'foo' : cannot convert parameter 1 from 'A' to 'A &' This is invalid c++ code. Microsoft decided not to support this feature in the future, see http://msdn.microsoft.com/en-us/library/s5b150wd(v=vs.71).aspx |
Build Identifier: Eclipse I20110613-1736 CDT 8.0 See steps to reproduce below... (The code compiles and works fine under VC++ compiler) Reproducible: Always Steps to Reproduce: Writing the following code causes "foo" to be unresolved: class A { int a; }; int foo(A &p) { return 0; } A get() { return A(); } int main() { foo(get()); // <- "foo" not resolved return 0; }