public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104995] New: access checking for function pointer template parameters takes place at call site
@ 2022-03-21 1:03 mawww at kakoune dot org
2022-03-21 1:12 ` [Bug c++/104995] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: mawww at kakoune dot org @ 2022-03-21 1:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104995
Bug ID: 104995
Summary: access checking for function pointer template
parameters takes place at call site
Product: gcc
Version: 11.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mawww at kakoune dot org
Target Milestone: ---
The following code
```
template<auto F>
void func() {
auto lambda = [&](auto&& s) { F(s); };
lambda(0);
}
struct S {
void f() { func<S::g>(); }
private:
static void g(int) {}
};
```
Fails to compile on g++ 11.2.1 with the following error:
```
test.cc: In instantiation of ‘func<S::g>()::<lambda(auto:1&&)> [with auto:1 =
int]’:
test.cc:4:11: required from ‘void func() [with auto F = S::g]’
test.cc:8:26: required from here
test.cc:3:36: error: ‘static void S::g(int)’ is private within this context
3 | auto lambda = [&](auto&& s) { F(s); };
| ~^~~
test.cc:11:17: note: declared private here
11 | static void g(int) {}
| ^
```
Clang accepts this code, making func's body just `{ F(0); }` compiles without
errors as well.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/104995] access checking for function pointer template parameters takes place at call site
2022-03-21 1:03 [Bug c++/104995] New: access checking for function pointer template parameters takes place at call site mawww at kakoune dot org
@ 2022-03-21 1:12 ` pinskia at gcc dot gnu.org
2023-01-03 18:07 ` [Bug c++/104995] access checking for function pointer template parameters takes place at call site inside a lambda pinskia at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-03-21 1:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104995
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |c++-lambda
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/104995] access checking for function pointer template parameters takes place at call site inside a lambda
2022-03-21 1:03 [Bug c++/104995] New: access checking for function pointer template parameters takes place at call site mawww at kakoune dot org
2022-03-21 1:12 ` [Bug c++/104995] " pinskia at gcc dot gnu.org
@ 2023-01-03 18:07 ` pinskia at gcc dot gnu.org
2023-03-25 14:43 ` [Bug c++/104995] [10/11/12/13 Regression] access checking for function pointer template parameters takes place at call site inside a templated (generic) lambda ppalka at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-03 18:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104995
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Summary|access checking for |access checking for
|function pointer template |function pointer template
|parameters takes place at |parameters takes place at
|call site |call site inside a lambda
Keywords| |c++-lambda
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-01-03
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/104995] [10/11/12/13 Regression] access checking for function pointer template parameters takes place at call site inside a templated (generic) lambda
2022-03-21 1:03 [Bug c++/104995] New: access checking for function pointer template parameters takes place at call site mawww at kakoune dot org
2022-03-21 1:12 ` [Bug c++/104995] " pinskia at gcc dot gnu.org
2023-01-03 18:07 ` [Bug c++/104995] access checking for function pointer template parameters takes place at call site inside a lambda pinskia at gcc dot gnu.org
@ 2023-03-25 14:43 ` ppalka at gcc dot gnu.org
2023-07-07 10:42 ` [Bug c++/104995] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-03-22 14:06 ` law at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-03-25 14:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104995
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|access checking for |[10/11/12/13 Regression]
|function pointer template |access checking for
|parameters takes place at |function pointer template
|call site inside a |parameters takes place at
|templated (generic) lambda |call site inside a
| |templated (generic) lambda
Target Milestone|--- |10.5
CC| |jason at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
C++14 testcase exhibiting a regression since GCC 8 / r8-2720-gf44a8dd56f5bfb:
template<void(*F)(int)>
void func() {
auto lambda = [&](auto&& s) { F(s); };
lambda(0);
}
struct S {
void f() { func<S::g>(); }
private:
static void g(int) {}
};
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/104995] [11/12/13/14 Regression] access checking for function pointer template parameters takes place at call site inside a templated (generic) lambda
2022-03-21 1:03 [Bug c++/104995] New: access checking for function pointer template parameters takes place at call site mawww at kakoune dot org
` (2 preceding siblings ...)
2023-03-25 14:43 ` [Bug c++/104995] [10/11/12/13 Regression] access checking for function pointer template parameters takes place at call site inside a templated (generic) lambda ppalka at gcc dot gnu.org
@ 2023-07-07 10:42 ` rguenth at gcc dot gnu.org
2024-03-22 14:06 ` law at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104995
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.5 |11.5
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/104995] [11/12/13/14 Regression] access checking for function pointer template parameters takes place at call site inside a templated (generic) lambda
2022-03-21 1:03 [Bug c++/104995] New: access checking for function pointer template parameters takes place at call site mawww at kakoune dot org
` (3 preceding siblings ...)
2023-07-07 10:42 ` [Bug c++/104995] [11/12/13/14 " rguenth at gcc dot gnu.org
@ 2024-03-22 14:06 ` law at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-22 14:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104995
Jeffrey A. Law <law at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |law at gcc dot gnu.org
Priority|P3 |P2
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-03-22 14:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21 1:03 [Bug c++/104995] New: access checking for function pointer template parameters takes place at call site mawww at kakoune dot org
2022-03-21 1:12 ` [Bug c++/104995] " pinskia at gcc dot gnu.org
2023-01-03 18:07 ` [Bug c++/104995] access checking for function pointer template parameters takes place at call site inside a lambda pinskia at gcc dot gnu.org
2023-03-25 14:43 ` [Bug c++/104995] [10/11/12/13 Regression] access checking for function pointer template parameters takes place at call site inside a templated (generic) lambda ppalka at gcc dot gnu.org
2023-07-07 10:42 ` [Bug c++/104995] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-03-22 14:06 ` law 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).