]> granicus.if.org Git - clang/commit
When computing the composite pointer type for relational comparisons,
authorDouglas Gregor <dgregor@apple.com>
Thu, 25 Feb 2010 22:29:57 +0000 (22:29 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 25 Feb 2010 22:29:57 +0000 (22:29 +0000)
commitb2cb1cbd727469e1567a6f2535895e6b64e12c35
tree643597bfc18435811b4b0d6c937cb6afe1dda1c0
parentdba6ef87a07f0cbab42b4aa98faaf4e6de8126d0
When computing the composite pointer type for relational comparisons,
equality comparisons, and conditional operators, produce a composite
pointer type with the appropriate additional "const" qualifiers if the
pointer types would otherwise be incompatible. This is a small
extension (also present in GCC and EDG in a slightly different form)
that permits code like:

  void** i; void const** j;
  i == j;

with the following extwarn:

t.cpp:5:5: warning: comparison of distinct pointer types ('void **' and
      'void const **') uses non-standard composite pointer type
      'void const *const *' [-pedantic]
  i == j;
  ~ ^  ~

Fixes PR6346, and I'll be filing a core issue about this with the C++
committee.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97177 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/Sema.h
lib/Sema/SemaExpr.cpp
lib/Sema/SemaExprCXX.cpp
test/SemaCXX/composite-pointer-type.cpp