- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
These warnings seem to be false-positive.
Move and init-list constructors need to be implicit.
Other linting tools specificly omit these constructors.
The warning messages from icc:
home/.../src/linear_map.h(206): warning #2304: non-explicit constructor with single argument may cause implicit type conversion
linear_map(std::initializer_list<value_type> init_list) {
^/home/.../src/linear_map.h(216): warning #2304: non-explicit constructor with single argument may cause implicit type conversion
linear_map(linear_map&& lm) noexcept : map_(std::move(lm.map_)) {}
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It looks like you are using the -Weffc++ option. You will get lots of "false positive" warnings when using this option. Some people find it not very useful for that reason.
I'm not sure what you mean when you say that move and initializer_list constructors always need to be implicit -- doesn't it depend upon whether you or not you just want to use them in conversions or not?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Judith Ward (Intel) wrote:I indeed use strict warnings from GCC: -Wall -Wextra -Wpedantic -Werror However, I ran ICC with '-Wno-effc++' to make sure that the error is not coming from that flag. When I ran with '-Weffc++' ICC produces a lot more warnings, so does GCC.
It looks like you are using the -Weffc++ option. You will get lots of "false positive" warnings when using this option. Some people find it not very useful for that reason.
Judith Ward (Intel) wrote:Move ctors just like copy ctors are implicit by default. Explicit init_list ctors lead to some pretty ugly code: std::vector<:VECTOR>
I'm not sure what you mean when you say that move and initializer_list constructors always need to be implicit -- doesn't it depend upon whether you or not you just want to use them in conversions or not?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you sure you're not using -Weffc++?
I don't see the warning with the flags you mentioned, i.e.:
sptxl15-186> cat t.cpp
struct C {
C(C&&);
};
sptxl15-187> icpc -std=c++11 -Wall -Wextra -Wpedantic -Werror -c t.cpp
icpc: command line warning #10006: ignoring unknown option '-Wpedantic'
sptxl15-188> icpc -std=c++11 -Weffc++ -c t.cpp
t.cpp(4): warning #2304: non-explicit constructor with single argument may cause implicit type conversion
C(C&&);
^
sptxl15-189> icpc -std=c++11 -Weffc++ -Wno-effc++ -c t.cpp
sptxl15-190>
Can you cut and paste the command line you are using? Also what version of the compiler are you using?
thanks
Judy
thanks
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Judith Ward (Intel) wrote:icc (ICC) 16.0.3 20160415 I couldn't reproduce it with the snippet code. Hmm, that's strange. The project is built with CMake : https://github.com/rakhimov/scram
Can you cut and paste the command line you are using? Also what version of the compiler are you using?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please also note that even with "-Weffc++",
these warnings should not be produced.
This is false positives for fundamental reasons.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I will file a separate bug report for "-Wnon-virtual-dtor" having a side effect with non-explict ctors.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page