Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 337688 - Bogus errors when using a function as a template parameter
Summary: Bogus errors when using a function as a template parameter
Status: CLOSED DUPLICATE of bug 337686
Alias: None
Product: CDT
Classification: Tools
Component: cdt-indexer (show other bugs)
Version: 8.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-21 03:38 EST by Nathan Ridge CLA
Modified: 2011-03-02 10:22 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Ridge CLA 2011-02-21 03:38:37 EST
For the following code:

struct A
{
    int x;
};

struct B
{
    A f(int);
};

template <typename Functor>
void g(Functor functor)
{
    B b;
    int y = b.f(functor()).x;  // ERRORS HERE
}

The parser gives two errors at the indicated line:

- Field 'x' could not be resolved
- Invalid arguments ' Candidates are: A f

These are bogus errors. The code is valid if g is instantiated with a Functor that does indeed return an int.

At most, the parser could complain if it detects that g is in fact being instantiated with a Functor that does not return an int, but even in that case the error should be at the instantiation site, not the definition site.
Comment 1 Markus Schorn CLA 2011-03-02 10:22:45 EST
Same root cause (function call on dependent name) as in bug 337686.

*** This bug has been marked as a duplicate of bug 337686 ***