Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__bases and __direct_bases intrinsics are not supported (N2965) #24289

Closed
llvmbot opened this issue Jun 23, 2015 · 8 comments
Closed

__bases and __direct_bases intrinsics are not supported (N2965) #24289

llvmbot opened this issue Jun 23, 2015 · 8 comments
Labels
bugzilla Issues migrated from bugzilla c++ clang:frontend Language frontend issues, e.g. anything involving "Sema" extension:gnu wontfix Issue is real, but we can't or won't fix it. Not invalid

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 23, 2015

Bugzilla Link 23915
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @tstellar,@jwakely

Extended Description

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

@jwakely
Copy link
Mannequin

jwakely mannequin commented Jan 15, 2016

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.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@jgehrcke
Copy link

jgehrcke commented Feb 8, 2024

Is this really still a known problem with recent releases of llvm/clang?

@Endilll
Copy link
Contributor

Endilll commented Feb 8, 2024

Well, we still don't support those intrinsics, as far as I can tell. I'm not sure something will change today if no action was taken back then.
@jwakely is __direct_bases still interesting to libstdc++?

@jwakely
Copy link
Contributor

jwakely commented Feb 8, 2024

No. I don't even remember what I was thinking of using it for. It's just an obscure, unused extension in a non-standard header.

@jwakely
Copy link
Contributor

jwakely commented Feb 8, 2024

I've just pushed this to fix the problem including that header with Clang:
https://gcc.gnu.org/r14-8888-g5fb204aaf34b68

hubot pushed a commit to gcc-mirror/gcc that referenced this issue Feb 8, 2024
These non-standard extensions use GCC-specific built-ins. Use
__has_builtin to avoid errors when Clang compiles this header.

See llvm/llvm-project#24289

libstdc++-v3/ChangeLog:

	* include/tr2/type_traits (bases, direct_bases): Use
	__has_builtin to check if required built-ins are supported.
wangliu-iscas pushed a commit to plctlab/patchwork-gcc that referenced this issue Feb 8, 2024
Tested x86_64-linux. Pusued to trunk. I'll backport it too.

-- >8 --

These non-standard extensions use GCC-specific built-ins. Use
__has_builtin to avoid errors when Clang compiles this header.

See llvm/llvm-project#24289

libstdc++-v3/ChangeLog:

	* include/tr2/type_traits (bases, direct_bases): Use
	__has_builtin to check if required built-ins are supported.
@Endilll
Copy link
Contributor

Endilll commented Feb 8, 2024

Thank you for the timely response!

@Endilll Endilll closed this as not planned Won't fix, can't repro, duplicate, stale Feb 8, 2024
@Endilll Endilll added wontfix Issue is real, but we can't or won't fix it. Not invalid c++ extension:gnu labels Feb 8, 2024
@llvmbot
Copy link
Collaborator Author

llvmbot commented Feb 8, 2024

@llvm/issue-subscribers-c-1

Author: None (llvmbot)

| | | | --- | --- | | Bugzilla Link | [23915](https://llvm.org/bz23915) | | Version | trunk | | OS | Linux | | Reporter | LLVM Bugzilla Contributor | | CC | @tstellar,@jwakely |

Extended Description

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 &lt;tr2/type_traits&gt;
$ 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&lt;__bases(_Tp)...&gt;            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&lt;typename _Tp&gt;
                    ^
/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&lt;__direct_bases(_Tp)...&gt;     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&lt;typename _Tp&gt;
                    ^
2 errors generated.

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

Alexey Frolov

Software Engineer
Intel Compiler Team
Intel

@jgehrcke
Copy link

jgehrcke commented Feb 9, 2024

Funky! I didn't even really understand the problem and got curious because we were facing a related one. Thanks for all the lovely momentum in here, this is a great example for splendid open-source collaboration.

hubot pushed a commit to gcc-mirror/gcc that referenced this issue Feb 16, 2024
These non-standard extensions use GCC-specific built-ins. Use
__has_builtin to avoid errors when Clang compiles this header.

See llvm/llvm-project#24289

libstdc++-v3/ChangeLog:

	* include/tr2/type_traits (bases, direct_bases): Use
	__has_builtin to check if required built-ins are supported.

(cherry picked from commit 5fb204a)
eebssk1 pushed a commit to eebssk1/m_gcc that referenced this issue Feb 17, 2024
These non-standard extensions use GCC-specific built-ins. Use
__has_builtin to avoid errors when Clang compiles this header.

See llvm/llvm-project#24289

libstdc++-v3/ChangeLog:

	* include/tr2/type_traits (bases, direct_bases): Use
	__has_builtin to check if required built-ins are supported.

(cherry picked from commit 5fb204aaf34b68c427f5b2bfb933fed72fe3eafb)
Liaoshihua pushed a commit to Liaoshihua/ruyi-gcc that referenced this issue Mar 11, 2024
These non-standard extensions use GCC-specific built-ins. Use
__has_builtin to avoid errors when Clang compiles this header.

See llvm/llvm-project#24289

libstdc++-v3/ChangeLog:

	* include/tr2/type_traits (bases, direct_bases): Use
	__has_builtin to check if required built-ins are supported.
Liaoshihua pushed a commit to Liaoshihua/ruyi-gcc that referenced this issue Mar 11, 2024
These non-standard extensions use GCC-specific built-ins. Use
__has_builtin to avoid errors when Clang compiles this header.

See llvm/llvm-project#24289

libstdc++-v3/ChangeLog:

	* include/tr2/type_traits (bases, direct_bases): Use
	__has_builtin to check if required built-ins are supported.
Liaoshihua pushed a commit to Liaoshihua/ruyi-gcc that referenced this issue Mar 11, 2024
These non-standard extensions use GCC-specific built-ins. Use
__has_builtin to avoid errors when Clang compiles this header.

See llvm/llvm-project#24289

libstdc++-v3/ChangeLog:

	* include/tr2/type_traits (bases, direct_bases): Use
	__has_builtin to check if required built-ins are supported.
Liaoshihua pushed a commit to Liaoshihua/ruyi-gcc that referenced this issue Mar 11, 2024
These non-standard extensions use GCC-specific built-ins. Use
__has_builtin to avoid errors when Clang compiles this header.

See llvm/llvm-project#24289

libstdc++-v3/ChangeLog:

	* include/tr2/type_traits (bases, direct_bases): Use
	__has_builtin to check if required built-ins are supported.
Liaoshihua pushed a commit to Liaoshihua/ruyi-gcc that referenced this issue Mar 11, 2024
These non-standard extensions use GCC-specific built-ins. Use
__has_builtin to avoid errors when Clang compiles this header.

See llvm/llvm-project#24289

libstdc++-v3/ChangeLog:

	* include/tr2/type_traits (bases, direct_bases): Use
	__has_builtin to check if required built-ins are supported.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++ clang:frontend Language frontend issues, e.g. anything involving "Sema" extension:gnu wontfix Issue is real, but we can't or won't fix it. Not invalid
Projects
None yet
Development

No branches or pull requests

4 participants