]> granicus.if.org Git - clang/commitdiff
PR20073: promote "dereference of 'void*'" from Extension to ExtWarn.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 19 May 2015 01:41:12 +0000 (01:41 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 19 May 2015 01:41:12 +0000 (01:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237652 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1inst.cpp
test/SemaCXX/reinterpret-cast.cpp

index 02be44639b6c70d4420edbeedfd84451c223cc33..2f419215782b3f41722b9d08e8827da55f104f47 100644 (file)
@@ -5030,7 +5030,7 @@ def err_typecheck_unary_expr : Error<
   "invalid argument type %0 to unary expression">;
 def err_typecheck_indirection_requires_pointer : Error<
   "indirection requires pointer operand (%0 invalid)">;
-def ext_typecheck_indirection_through_void_pointer : Extension<
+def ext_typecheck_indirection_through_void_pointer : ExtWarn<
   "ISO C++ does not allow indirection on operand of type %0">,
   InGroup<DiagGroup<"void-ptr-dereference">>;
 def warn_indirection_through_null : Warning<
index f09faa90d5f952a3f11c1a6f52aa0c4f78079a8a..eb11e3375e5f69ee3556b729737179062afb70f0 100644 (file)
@@ -8,7 +8,7 @@ struct X0 {
 
 template<typename T, typename U>
 void X0<T, U>::f(T *t, const U &u) {
-  *t = u; // expected-error{{not assignable}}
+  *t = u; // expected-warning{{indirection on operand of type 'void *'}} expected-error{{not assignable}}
 }
 
 void test_f(X0<float, int> xfi, X0<void, int> xvi, float *fp, void *vp, int i) {
index 4284032d9ba9bb3ef46c8d7ef93c2c45a866abb6..7c88dc0302ad65466ecc7e3e45fe5e00df9080e9 100644 (file)
@@ -201,11 +201,11 @@ void dereference_reinterpret_cast() {
   (void)*reinterpret_cast<float*>(v_ptr);
 
   // Casting to void pointer
-  (void)*reinterpret_cast<void*>(&a);
-  (void)*reinterpret_cast<void*>(&b);
-  (void)*reinterpret_cast<void*>(&l);
-  (void)*reinterpret_cast<void*>(&d);
-  (void)*reinterpret_cast<void*>(&f);
+  (void)*reinterpret_cast<void*>(&a); // expected-warning {{ISO C++ does not allow}}
+  (void)*reinterpret_cast<void*>(&b); // expected-warning {{ISO C++ does not allow}}
+  (void)*reinterpret_cast<void*>(&l); // expected-warning {{ISO C++ does not allow}}
+  (void)*reinterpret_cast<void*>(&d); // expected-warning {{ISO C++ does not allow}}
+  (void)*reinterpret_cast<void*>(&f); // expected-warning {{ISO C++ does not allow}}
 }
 
 void reinterpret_cast_whitelist () {