auto and decltype availability

Does anyone know which released version first had the auto and decltype features ‘turned on’? And generally speaking, is there an easy way to determine this for any given C++0x feature?

For some background, I’m working on a series of C++0x presentations at the company I work for, and at the end of every presentation I have a chart that shows the availability of the features I discussed that day. Currently we are not using clang, but I have an entry for it because I want to show that clang is trying to keeping pace with GCC and surpassing IBM XL C/C++ and Sun Studio.

Thanks!

Hi Michael,

We recommend that people write code that uses __has_feature to check for a feature, not compare against a compiler version number. These are documented here:
http://clang.llvm.org/docs/LanguageExtensions.html#feature_check

-Chris

I think that is a perfectly fine recommendation, but this isn’t for writing code. This is for letting people know which version of the compiler first introduced a certain feature. For instance, if we want to use static_assert, we may (depending on other feature availability) only want to update to the version of clang that supported the features that we desire.

It’s hard to convince managers that we should update (or even switch compilers) if we have to respond with “use __has_feature in the code”.

I think that is a perfectly fine recommendation, but this isn’t for writing code. This is for letting people know which version of the compiler first introduced a certain feature. For instance, if we want to use static_assert, we may (depending on other feature availability) only want to update to the version of clang that supported the features that we desire.

It’s hard to convince managers that we should update (or even switch compilers) if we have to respond with “use __has_feature in the code”.

Ok, are you asking about llvm.org compilers, apple compilers, someone else’s compilers? Everyone has their own versioning scheme :).

-Chris

I guess I’ll be verbose then. :slight_smile:

What is the release version number(s) of the LLVM project that first included a clang frontend that linked in a version of libclang that was able to correctly (according to a reasonably recent draft of the C++0x standard) handle the ‘auto’ and ‘decltype’ keywords?

Probably either 2.9 or none yet. Try it? :slight_smile:

Nico
Brevity due to phone

} What is the release version number(s) of the LLVM project that first
} included a clang frontend that linked in a version of libclang that
} was able to correctly (according to a reasonably recent draft of the
} C++0x standard) handle the 'auto' and 'decltype' keywords?

In my limited experience, llvm releases are pretty far apart. You may
be better served by just saying the date that the completed
functionality was submitted to top-of-tree clang.

How I would do it (caveat: I'm no expert on clang nor llvm), would be
to look for commits that updated http://clang.llvm.org/cxx_status.html.
One way to do that would be here:
   http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?view=log

craig

You suggestion make me think about an other file that let you know the exact revision that enabled a c++0x feature.

clang/test/Lexer/has_feature_cxx0x.cpp

This is the test files which test the __has_feature() macro for each c++0x feature.

http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/has_feature_cxx0x.cpp?view=log

For instance, auto_type was enabled in commit r126078

-- Jean-Daniel

The 'auto' type specifier became available in version 2.9. Some
auto-related issues were fixed in r126166, and cxx_status.html was updated
in r128787 in preparation for the 2.9 release.

Full support for 'decltype' in the type of a function template required
tracking instantiation dependence, which we did not yet do in version 2.9.
However, 'decltype' in other contexts was working in 2.9 (and quite
possibly in several earlier releases).

Richard

Thank you, Richard. For (almost) all practical purposes, auto and decltype were in LLVM/Clang 2.9. Instantiation dependence only affects name mangling at this point.

The meta-point here is that we should certainly track this better. GCC's C++0x status page shows which GCC version introduced each C++0x feature. We should do the same (for llvm.org's releases; vendors can communicate with their customers through their own channels).

  - Doug