Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

Commit

Permalink
Add information for checking MISRA C++:2008 rule 5-0-5
Browse files Browse the repository at this point in the history
  • Loading branch information
rettichschnidi committed Apr 17, 2016
1 parent bccc152 commit 70aefe4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion doc/cpp2008.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ Expressions
|5-0-2 | TBD | |
|5-0-3 | TBD | |
|5-0-4 | -Wsign-conversion | |
|5-0-5 | TBD | |
|5-0-5 | -Wliteral-conversion | |
|5-0-6 | -Wconversion | |
|5-0-7 | TBD | |
|5-0-8 | TBD | |
Expand Down
4 changes: 4 additions & 0 deletions test/cpp2008/5-0-5.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// RUN: %clang -fsyntax-only -Wliteral-conversion -Xclang -verify %s

int iFromF = 3.5F; // expected-warning {{implicit conversion from 'float' to 'int' changes value from 3.5 to 3}}
int iFromD = 3.5; // expected-warning {{implicit conversion from 'double' to 'int' changes value from 3.5 to 3}}

0 comments on commit 70aefe4

Please sign in to comment.