Status of explicit conversion operators and nullptr

Hello,

according to <http://clang.llvm.org/cxx_status.html&gt;, 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:
THANK YOU! :slight_smile:

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
work").

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
something?

With many thanks in advance,
Jonathan

Hi All,

I am seeing three new failures today after I did an llvm update and built it for apple-darwin.

Failing Tests (3):
    Clang :: CodeGenCXX/vtable-debug-info.cpp
    Clang :: CodeGenObjC/debug-info-getter-name.m
    Clang :: Driver/hello.c

- Fariborz

I don't believe that explicit conversions are fully implemented. At the very least, we need an audit + test cases for all of the places where we look at implicit conversions, to ensure that we're properly enabling/disabling explicit conversion functions at the right times.

nullptr is basically fully implemented. The only remaining issue I know of is that a thrown std::nullptr won't be caught as a T*, which is rather minor and might be more of a runtime issue . I'd appreciate it if you could send a patch for the status page!

  - Doug

It looks like this might be related to compiling clang with gcc vs. with clang. Seems that if you compile the latest clang with gcc, the resulting compiler has problems.

Jonathan

Try again with r135594 :slight_smile:

- Ben

Try updating to r135594 or later.

-Eli

Thanks! That fixes it for me.

Jonathan

Thanks to all who responded. TOT has since fixed the bug.

- Fariborz