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

Bug 368256

Summary: [fp] "Invalid arguments" from failing to evaluate default arguments
Product: [Tools] CDT Reporter: Josh Kelley <joshkel>
Component: cdt-codanAssignee: CDT Codan Inbox <cdt-codan-inbox>
Status: RESOLVED WORKSFORME QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: normal    
Priority: P3 CC: cdtdoug, malaperle, yevshif, zeratul976
Version: 8.1.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Josh Kelley CLA 2012-01-10 09:55:30 EST
Build Identifier: Version: Indigo Service Release 1  Build id: 20110916-0149

I'm getting an "Invalid arguments" error from code analysis for code similar to the following:

test.h:
#ifndef TESTH
#define TESTH

#include <time.h>

void HandleException(const std::exception& e, const char *NULL);
void ProcessItem(const char *directory, time_t timestamp = time(NULL));

#endif

test.cpp:
#include <test.h>

int main(int, char**)
{
  try {
    ProcessItem(".");
  } catch (std::exception& e) {
    HandleException(e);
  }
}


Both the ProcessItem call and the HandleException call generate "Invalid arguments" errors, as if the code analysis fails to consider the default arguments.  If I explicitly pass the last argument, then the code works.

This happens every time I use two particular functions in my application code, although so far, I've been unable to reproduce it in standalone test code.  I've tried rebuilding the indexes, but that hasn't helped.

This is possibly related to #356011 (which also could not be reproduced).

Reproducible: Sometimes
Comment 1 Nathan Ridge CLA 2013-07-17 22:03:59 EDT
Your example works fine for me with CDT 8.2 (Kepler).
Comment 2 Marc-André Laperle CLA 2013-07-18 00:00:51 EDT
Works for me as well. Please reopen the bug if you can reproduce with Kepler.