Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368256 - [fp] "Invalid arguments" from failing to evaluate default arguments
Summary: [fp] "Invalid arguments" from failing to evaluate default arguments
Status: RESOLVED WORKSFORME
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: 8.1.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: CDT Codan Inbox CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-10 09:55 EST by Josh Kelley CLA
Modified: 2013-07-18 00:00 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.