[cfe-commits] r108234 - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ lib/AST/ lib/Rewrite/ lib/Sema/ test/CodeGen/ test/Sema/ test/SemaCXX/ test/SemaTemplate/

Eli Friedman eli.friedman at gmail.com
Tue Jul 13 01:57:38 PDT 2010


On Tue, Jul 13, 2010 at 1:18 AM, Douglas Gregor <dgregor at apple.com> wrote:
> Author: dgregor
> Date: Tue Jul 13 03:18:22 2010
> New Revision: 108234
>
> URL: http://llvm.org/viewvc/llvm-project?rev=108234&view=rev
> Log:
> When forming a function call or message send expression, be sure to
> strip cv-qualifiers from the expression's type when the language calls
> for it: in C, that's all the time, while C++ only does it for
> non-class types.
>
> Centralized the computation of the call expression type in
> QualType::getCallResultType() and some helper functions in other nodes
> (FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant
> callers of getResultType() to getCallResultType().
>
> Fixes PR7598 and PR7463, along with a bunch of getResultType() call
> sites that weren't stripping references off the result type (nothing
> stripped cv-qualifiers properly before this change).

There are some other places with similar problems, e.g.:
#include <stdarg.h>
template <typename T_> void g (T_&);
void a(va_list x) {
  g(va_arg(x, const int));
}

template <typename T_> void g (T_&);
void a() {
  g((const int)0);
}

template <typename T_> void g (T_&);
void a() {
  typedef const int cint;
  g(cint(0));
}

template <typename T_> void g (T_&);
void a() {
  g(static_cast<const int>(1));
}

template <typename T_> void g (T_&);
void a() {
  g(reinterpret_cast<int *const>(0));
}

template <typename T_> void g (T_&);
template<const int X> void h() { g(X); }
void a() { h<0>(); }

-Eli



More information about the cfe-commits mailing list