Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 358694

Summary: False warning about Unused static function in template
Product: [Tools] CDT Reporter: Axel Mueller <aegges>
Component: cdt-codanAssignee: Nathan Ridge <zeratul976>
Status: RESOLVED FIXED QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: normal    
Priority: P3 CC: angvoz.dev, cdtdoug, eclipse.sprigogin, malaperle, yevshif, zeratul976
Version: 8.1.1   
Target Milestone: 8.3.0   
Hardware: PC   
OS: All   
Whiteboard:

Description Axel Mueller CLA 2011-09-23 04:39:24 EDT
Build Identifier: CDT 8.0

Testcode:
static inline void add( float * f)
{
  f += 1.0F;
}

static inline void add( int * f)
{
  f += 1;
}

template<typename T>
static inline void Myadd( T* Val)
{
    add( Val);
}

int main()
{
  int a = 5;
  MyAdd(&a);
  return 0;
}

CODAN reports "Unused static function" for both static functions add.

Reproducible: Always
Comment 1 Andrew Gvozdev CLA 2013-07-18 02:19:43 EDT
Nathan, you looked at this checker recently. Would be this one easy to fix?
Comment 2 Nathan Ridge CLA 2013-07-18 02:25:59 EDT
(In reply to comment #1)
> Nathan, you looked at this checker recently. Would be this one easy to fix?

I will have a look. This has been annoying me, too.
Comment 3 Nathan Ridge CLA 2013-07-19 01:17:19 EDT
Turned out to be quite straightforward. Patch: https://git.eclipse.org/r/#/c/14680/
Comment 4 Marc-André Laperle CLA 2013-07-20 21:46:02 EDT
Fixed in master.