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

Bug 368606

Summary: erroneous warning of "invalid arguments" for method arguments of type std::vector<bool>::reference / std::_Bit_reference
Product: [Tools] CDT Reporter: Gero Bugs <gero>
Component: cdt-codanAssignee: CDT Codan Inbox <cdt-codan-inbox>
Status: RESOLVED WORKSFORME QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: normal    
Priority: P3 CC: cdtdoug, yevshif, zeratul976
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=349849
https://bugs.eclipse.org/bugs/show_bug.cgi?id=357304
Whiteboard:

Description Gero Bugs CLA 2012-01-14 14:38:31 EST
Build Identifier: Version: Indigo Service Release 1 Build id: 20110916-0149

The following code compiles with no problem but CDT shows an error:

class X {
  void bitReferenceMethod( std::vector<bool>::reference reference ) {}
  
  void methodCaller() {
    std::vector<bool> bitVector;
    bitReferenceMethod( bitVector[0] );
  }
};

There is a wiggly line under 'bitReferenceMethod' with the message:
"Invalid arguments ' Candidates are: void bitReferenceMethod(std::_Bit_reference)"
--but bitVector[0] does resolve to type std::_Bit_reference! (And what is that single quote doing in the error message?)

Reproducible: Always

Steps to Reproduce:
Just copy the class definition above into the CDT editor.
Comment 1 Gero Bugs CLA 2012-01-14 14:52:38 EST
BTW, casting (redundantly) bitVector[0] to std::_Bit_reference makes the error go away. I guess that suggests that CDT is not resolving the type of bitVector[0] correctly?
Comment 2 Gero Bugs CLA 2012-01-16 05:50:15 EST
Another problem that could be related:

On an std::vector<bool> object, code completion correctly proposes methods such as push_back(...) or at(...) but then the editor marks them with a wiggly line, again with the "Invalid arguments" comment when the arguments really are correct.

Bug #349849 and #357304 also report similar problems. Maybe this is something bigger? Alas, even the oldest of these bugs is still unassigned half a year after filing.
Comment 3 Nathan Ridge CLA 2013-07-17 21:55:57 EDT
Works fine for me with CDT 8.2 (Kepler).
Comment 4 Nathan Ridge CLA 2016-12-29 18:28:06 EST
Closing per comment 3. Feel free to reopen if you're still seeing this.