r313909 - Add testcase I forgot to add in R313907.

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 21 13:14:08 PDT 2017


Author: erichkeane
Date: Thu Sep 21 13:14:08 2017
New Revision: 313909

URL: http://llvm.org/viewvc/llvm-project?rev=313909&view=rev
Log:
Add testcase I forgot to add in R313907.

Added:
    cfe/trunk/test/SemaCXX/warn-sign-conversion-cpp11.cpp   (with props)

Added: cfe/trunk/test/SemaCXX/warn-sign-conversion-cpp11.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-sign-conversion-cpp11.cpp?rev=313909&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-sign-conversion-cpp11.cpp (added)
+++ cfe/trunk/test/SemaCXX/warn-sign-conversion-cpp11.cpp Thu Sep 21 13:14:08 2017
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wsign-conversion -std=c++11 %s
+
+unsigned int test() {
+  short foo;
+  return foo; // expected-warning {{implicit conversion changes signedness}}
+
+}
+
+unsigned int test3() {
+  // For a non-defined enum, use the underlying type.
+  enum u8 : signed char;
+  u8 foo{static_cast<u8>(0)};
+  return foo; // expected-warning {{implicit conversion changes signedness}}
+
+}
+unsigned int test2() {
+  // For a non-defined enum, use the underlying type.
+  enum u8 : unsigned char;
+  u8 foo{static_cast<u8>(0)};
+  return foo;
+}

Propchange: cfe/trunk/test/SemaCXX/warn-sign-conversion-cpp11.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/trunk/test/SemaCXX/warn-sign-conversion-cpp11.cpp
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: cfe/trunk/test/SemaCXX/warn-sign-conversion-cpp11.cpp
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the cfe-commits mailing list