LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 23915 - __bases and __direct_bases intrinsics are not supported (N2965)
Summary: __bases and __direct_bases intrinsics are not supported (N2965)
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: Frontend (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-22 17:39 PDT by Alexey Frolov
Modified: 2017-04-26 07:15 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Frolov 2015-06-22 17:39:18 PDT
Clang cannot compile GCC header tr2/type_traits (see below).
Type traits "bases" and "direct_bases" were proposed as N2965 for C++11 standard, but were not included.
The feature is well-documented (see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2965.html) and is supported by GCC.
There are some questions and requests regarding this feature on developer forums (for example, http://stackoverflow.com/questions/18435001/what-is-the-status-of-n2965-stdbases-and-stddirect-bases).

$ clang --version
clang version 3.7.0 (trunk)
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ cat test.cpp
#include <tr2/type_traits>

$ clang -std=c++11 -c test.cpp
In file included from test.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/tr2/type_traits:90:45: error: '_Tp' does not refer to a value
      typedef __reflection_typelist<__bases(_Tp)...>            type;
                                            ^
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/tr2/type_traits:87:21: note: declared here
  template<typename _Tp>
                    ^
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/tr2/type_traits:97:52: error: '_Tp' does not refer to a value
      typedef __reflection_typelist<__direct_bases(_Tp)...>     type;
                                                   ^
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/tr2/type_traits:94:21: note: declared here
  template<typename _Tp>
                    ^
2 errors generated.

As you can see, Clang does not support __bases and __direct_bases intrinsics.

Alexey Frolov
=============
Software Engineer
Intel Compiler Team
Intel
Comment 1 Jonathan Wakely 2016-01-15 07:04:43 PST
I'm considering using __direct_bases in libstdc++'s <random> so it would not only be used in an obscure, non-standard extension. Would implementing that intrinsic be a problem for Clang?

If necessary I could check __clang__ and use an inferior solution instead of __direct_bases, but I'd prefer not to do that extra work.