Bug 505810 - False positive "Unused declaration of function" warning when function is found via ADL
Summary: False positive "Unused declaration of function" warning when function is foun...
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: Next   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: CDT Codan Inbox CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-12 12:15 EDT by Nathan Ridge CLA
Modified: 2016-10-12 12:15 EDT (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 2016-10-12 12:15:50 EDT
The following code:


template <typename T>
int foo(T t)
{
    return bar(t);
}

namespace N
{
    class A {};
    int bar(N::A);  // WARNING: Unused declaration of function 'bar'
}

int main()
{
    foo(N::A());
}


produces a warning at the indicated location. This warning is a false positive, as the code does use bar(). bar() found by argument-dependent lookup during the instantiation of foo() with T = N::A.