Bug 577478 - std::map insert and std::pair give wrong Invalid arguments errors with /std:c++17
Summary: std::map insert and std::pair give wrong Invalid arguments errors with /std:c...
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-indexer (show other bugs)
Version: 10.5.0   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: cxx17
  Show dependency tree
 
Reported: 2021-11-26 03:32 EST by Michael Teske CLA
Modified: 2021-12-13 10:05 EST (History)
2 users (show)

See Also:


Attachments
eclipse parser log (183.67 KB, application/octet-stream)
2021-11-26 03:32 EST, Michael Teske CLA
no flags Details
test program (415 bytes, text/plain)
2021-11-26 03:33 EST, Michael Teske CLA
no flags Details
the test program preprocessed with cl.exe /P /C (1.21 MB, text/plain)
2021-11-27 10:41 EST, Michael Teske CLA
no flags Details
test program preprocessed with cl.exe /P /C /std:c++17 (1.38 MB, text/plain)
2021-11-27 10:49 EST, Michael Teske CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Teske CLA 2021-11-26 03:32:29 EST
Created attachment 287574 [details]
eclipse parser log

This is with MSVC 2019, Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30137 for x64 and Microsoft Visual C++ toolchain

in a newly created project I have this simple test program:

#include <map>
#include <string>
int main() {
	std::map<std::string, int> mymap;
	std::string field;
	int id;
	auto p = mymap.insert(std::make_pair(field, id)); // error 'Invalid arguments'
	auto mypair1 = std::make_pair(field,id);  // fine
	mymap.insert(mypair1); //error 'Invalid arguments'
	std::pair<std::string, int> mypair2(field,id);  // error 'Invalid arguments'
	mymap[field] = id; // fine

	return 0;
}

the errors are marked with comments. 

Of course, build project works fine.
Comment 1 Michael Teske CLA 2021-11-26 03:33:19 EST
Created attachment 287575 [details]
test program
Comment 2 Michael Teske CLA 2021-11-27 10:41:10 EST
Created attachment 287580 [details]
the test program preprocessed with cl.exe /P /C

strangely, with the preprocessed source it works.
Comment 3 Michael Teske CLA 2021-11-27 10:49:56 EST
Created attachment 287581 [details]
test program preprocessed with cl.exe /P /C /std:c++17

here it's reproduced. When the test program is preprocessed with /std:c++17, the preprocessed source gives the same error as the plain file.
Comment 4 Michael Teske CLA 2021-12-13 07:42:42 EST
Just upgraded Eclipse, the behaviour is the same with 10.5.0.
Comment 5 Jonah Graham CLA 2021-12-13 10:05:32 EST
Hi Michael, Thanks for the report. C++ 17 is not fully supported yet. I have added Bug 490406, the umbrella bug for C++ 17 support.