public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/105128] New: source_location compile error for clang
@ 2022-04-01 15:32 unlvsur at live dot com
2022-04-01 15:39 ` [Bug libstdc++/105128] source_location compile error for latest clang 15 unlvsur at live dot com
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: unlvsur at live dot com @ 2022-04-01 15:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105128
Bug ID: 105128
Summary: source_location compile error for clang
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: unlvsur at live dot com
Target Milestone: ---
It looks like clang just added source_location implementation but the built-in
looks different. Unfortunately, libcxx does not implement this either at this
point. However, the testsuite probably tells how clang implements this.
https://github.com/llvm/llvm-project/blob/d61487490022aaacc34249475fac3e208c7d767e/clang/test/CodeGenCXX/builtin-source-location.cpp
#include<source_location>
int main()
{
std::source_location::current();
}
clang++ -o sourcelocation sourcelocation.cc -Ofast -std=c++2b -s -flto=thin
-fuse-ld=lld
In file included from sourcelocation.cc:1:
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/12.0.1/../../../../include/c++/12.0.1/source_location:46:41:
error: 'std::source_location::__impl' was not found; it must be defined before
'__builtin_source_location' is called
using __builtin_ret_type = decltype(__builtin_source_location());
^
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/12.0.1/../../../../include/c++/12.0.1/source_location:52:13:
error: unknown type name '__builtin_ret_type'
current(__builtin_ret_type __p = __builtin_source_location()) noexcept
^
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/12.0.1/../../../../include/c++/12.0.1/source_location:52:32:
error: cannot initialize a parameter of type 'int' with an rvalue of type
'const std::source_location::__impl *'
current(__builtin_ret_type __p = __builtin_source_location()) noexcept
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/12.0.1/../../../../include/c++/12.0.1/source_location:52:32:
note: passing argument to parameter '__p' here
3 errors generated.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/105128] source_location compile error for latest clang 15
2022-04-01 15:32 [Bug libstdc++/105128] New: source_location compile error for clang unlvsur at live dot com
@ 2022-04-01 15:39 ` unlvsur at live dot com
2022-04-01 17:50 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: unlvsur at live dot com @ 2022-04-01 15:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105128
--- Comment #1 from cqwrteur <unlvsur at live dot com> ---
Created attachment 52736
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52736&action=edit
Modified source_location header that works on both gcc and clang
It looks like clang requires __impl to be defined before
__builtin_source_location() call. Just change the location for where it should
be defined and it works.
Can we fix it?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/105128] source_location compile error for latest clang 15
2022-04-01 15:32 [Bug libstdc++/105128] New: source_location compile error for clang unlvsur at live dot com
2022-04-01 15:39 ` [Bug libstdc++/105128] source_location compile error for latest clang 15 unlvsur at live dot com
@ 2022-04-01 17:50 ` jakub at gcc dot gnu.org
2022-04-01 18:07 ` unlvsur at live dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-04-01 17:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105128
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 52738
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52738&action=edit
gcc12-pr105128.patch
So like this untested patch?
Can test it with gcc, but don't have a new enough clang around.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/105128] source_location compile error for latest clang 15
2022-04-01 15:32 [Bug libstdc++/105128] New: source_location compile error for clang unlvsur at live dot com
2022-04-01 15:39 ` [Bug libstdc++/105128] source_location compile error for latest clang 15 unlvsur at live dot com
2022-04-01 17:50 ` jakub at gcc dot gnu.org
@ 2022-04-01 18:07 ` unlvsur at live dot com
2022-04-02 10:50 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: unlvsur at live dot com @ 2022-04-01 18:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105128
--- Comment #3 from cqwrteur <unlvsur at live dot com> ---
(In reply to Jakub Jelinek from comment #2)
> Created attachment 52738 [details]
> gcc12-pr105128.patch
>
> So like this untested patch?
> Can test it with gcc, but don't have a new enough clang around.
yes, it should work on clang.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/105128] source_location compile error for latest clang 15
2022-04-01 15:32 [Bug libstdc++/105128] New: source_location compile error for clang unlvsur at live dot com
` (2 preceding siblings ...)
2022-04-01 18:07 ` unlvsur at live dot com
@ 2022-04-02 10:50 ` cvs-commit at gcc dot gnu.org
2022-04-02 10:51 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-02 10:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105128
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:2a82301d409d3aa0e0b3b884e4c6daeaa0486d6b
commit r12-7968-g2a82301d409d3aa0e0b3b884e4c6daeaa0486d6b
Author: Jakub Jelinek <jakub@redhat.com>
Date: Sat Apr 2 12:49:38 2022 +0200
libstdc++: Tweak source_location for clang trunk [PR105128]
Apparently clang trunk implemented __builtin_source_location(), but the
using __builtin_ret_type = decltype(__builtin_source_location());
which has been added for it isn't enough, they also need the
std::source_location::__impl class to be defined (but incomplete seems
to be good enough) before the builtin is used.
The following has been tested on godbolt with clang trunk (old version
fails with
error: 'std::source_location::__impl' was not found; it must be defined
before '__builtin_source_location' is called
and some follow-up errors), getting back to just void * instead of
__builtin_ret_type and commenting out using doesn't work either and
just struct __impl; before using __builtin_ret_type doesn't work too.
2022-04-02 Jakub Jelinek <jakub@redhat.com>
PR libstdc++/105128
* include/std/source_location (std::source_location::__impl): Move
definition before using __builtin_ret_type.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/105128] source_location compile error for latest clang 15
2022-04-01 15:32 [Bug libstdc++/105128] New: source_location compile error for clang unlvsur at live dot com
` (3 preceding siblings ...)
2022-04-02 10:50 ` cvs-commit at gcc dot gnu.org
@ 2022-04-02 10:51 ` jakub at gcc dot gnu.org
2022-07-07 23:32 ` cvs-commit at gcc dot gnu.org
2022-07-07 23:33 ` redi at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-04-02 10:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105128
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/105128] source_location compile error for latest clang 15
2022-04-01 15:32 [Bug libstdc++/105128] New: source_location compile error for clang unlvsur at live dot com
` (4 preceding siblings ...)
2022-04-02 10:51 ` jakub at gcc dot gnu.org
@ 2022-07-07 23:32 ` cvs-commit at gcc dot gnu.org
2022-07-07 23:33 ` redi at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-07 23:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105128
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:16946c7c823c2d6531ac272d31d68d95d9c30ddd
commit r11-10116-g16946c7c823c2d6531ac272d31d68d95d9c30ddd
Author: Jakub Jelinek <jakub@redhat.com>
Date: Sat Apr 2 12:49:38 2022 +0200
libstdc++: Tweak source_location for clang trunk [PR105128]
Apparently clang trunk implemented __builtin_source_location(), but the
using __builtin_ret_type = decltype(__builtin_source_location());
which has been added for it isn't enough, they also need the
std::source_location::__impl class to be defined (but incomplete seems
to be good enough) before the builtin is used.
The following has been tested on godbolt with clang trunk (old version
fails with
error: 'std::source_location::__impl' was not found; it must be defined
before '__builtin_source_location' is called
and some follow-up errors), getting back to just void * instead of
__builtin_ret_type and commenting out using doesn't work either and
just struct __impl; before using __builtin_ret_type doesn't work too.
2022-04-02 Jakub Jelinek <jakub@redhat.com>
PR libstdc++/105128
* include/std/source_location (std::source_location::__impl): Move
definition before using __builtin_ret_type.
(cherry picked from commit 2a82301d409d3aa0e0b3b884e4c6daeaa0486d6b)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/105128] source_location compile error for latest clang 15
2022-04-01 15:32 [Bug libstdc++/105128] New: source_location compile error for clang unlvsur at live dot com
` (5 preceding siblings ...)
2022-07-07 23:32 ` cvs-commit at gcc dot gnu.org
@ 2022-07-07 23:33 ` redi at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2022-07-07 23:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105128
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.4
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Backported for 11.4
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-07-07 23:33 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-01 15:32 [Bug libstdc++/105128] New: source_location compile error for clang unlvsur at live dot com
2022-04-01 15:39 ` [Bug libstdc++/105128] source_location compile error for latest clang 15 unlvsur at live dot com
2022-04-01 17:50 ` jakub at gcc dot gnu.org
2022-04-01 18:07 ` unlvsur at live dot com
2022-04-02 10:50 ` cvs-commit at gcc dot gnu.org
2022-04-02 10:51 ` jakub at gcc dot gnu.org
2022-07-07 23:32 ` cvs-commit at gcc dot gnu.org
2022-07-07 23:33 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).