[PATCH] D49457: DR330: when determining whether a cast casts away constness, consider qualifiers from all levels matching a multidimensional array

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 17 16:42:08 PDT 2018


rsmith created this revision.
rsmith added a reviewer: rjmccall.

DR330: when determining whether a cast casts away constness, consider
qualifiers from all levels matching a multidimensional array.

For example, this allows casting from

  pointer to       array of            array of   const volatile int

to

  pointer to const pointer to volatile pointer to                int

because the multidimensional array part of the source type corresponds
to a part of the destination type that contains both 'const' and
'volatile'.

Fixes the bug reported here: https://github.com/apple/swift/pull/17882#discussion_r203196368


Repository:
  rC Clang

https://reviews.llvm.org/D49457

Files:
  include/clang/AST/ASTContext.h
  lib/AST/ASTContext.cpp
  lib/Sema/SemaCast.cpp
  test/CXX/drs/dr3xx.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49457.155986.patch
Type: text/x-patch
Size: 8429 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180717/93ba1a77/attachment.bin>


More information about the cfe-commits mailing list