https://bugs.llvm.org/show_bug.cgi?id=40383
Bug ID: 40383
Summary: Broken incorrect fix-it for -Wc++11-narrowing
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangb...@nondot.org
Reporter: lebedev...@gmail.com
CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
richard-l...@metafoo.co.uk
https://godbolt.org/z/DkP1ns
struct S {
using value_type = char;
value_type k;
S (value_type k_) : k(k_){};
};
S test(int i) {
return {i};
}
<source>:8:13: error: non-constant-expression cannot be narrowed from type
'int' to 'S::value_type' (aka 'char') in initializer list [-Wc++11-narrowing]
return {i};
^
<source>:8:13: note: insert an explicit cast to silence this issue
return {i};
^
static_cast<value_type>( )
1 error generated.
Compiler returned: 1
static_cast<value_type>( ) <- that is clearly wrong.
It should be something like static_cast<S::value_type>( )
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs