[cfe-dev] Status of explicit conversion operators and nullptr

Jonathan Sauer jonathan.sauer at gmx.de
Wed Jul 20 09:19:56 PDT 2011


according to <http://clang.llvm.org/cxx_status.html>, explicit conversion operators are currently
not really functional:

| No name mangling; ASTs don't contain calls to conversion operators

I just tried using them and to my delight they worked: Not only did the code compile (after I inserted
the missing explicit casts), the resulting application ran without a hitch. To whomever implemented it:

The code I used them in was:

template <typename T, unsigned int FractBits>
class Fixed {

  // Convert to a float
  explicit inline operator float() const;

  // Convert to any integer
  template <typename U, typename std::enable_if<std::is_integral<U>::value, int>::type = 0>
  explicit inline operator U() const;

I therefore think that the above status page should be updated at least to yellow ("many examples

The same goes for nullptr support: I have been using it successfully for weeks now (almost) without
problems. Code generation most certainly isn't "broken". __has_feature(cxx_nullptr) also evaluates
to "1".

Are these assessments correct (and should I send a patch for the status page), or am I overlooking

With many thanks in advance,

More information about the cfe-dev mailing list