public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104488] New: Wrong access specification in method pointer assignment
@ 2022-02-10 15:02 me at elchris dot org
2022-02-10 16:56 ` [Bug c++/104488] " redi at gcc dot gnu.org
2022-02-10 22:03 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: me at elchris dot org @ 2022-02-10 15:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104488
Bug ID: 104488
Summary: Wrong access specification in method pointer
assignment
Product: gcc
Version: og11 (devel/omp/gcc-11)
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: me at elchris dot org
Target Milestone: ---
Created attachment 52405
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52405&action=edit
someFunc is made public by using but the method ptr assignment does not
recognize it
## Source Code
```
// file: blubb.cpp
template <typename T>
class Parent {
protected:
template <typename R = T>
void someFunc() {}
};
class Child : public Parent<int> {
public:
using Parent::someFunc;
};
int main() { void (Child::*methodPtr)() = &Child::someFunc; }
```
## Compilation command
```
g++ blubb.cpp
```
## Error
```
blubb.cpp: In function ‘int main()’:
blubb.cpp:13:51: error: ‘void Parent<T>::someFunc() [with R = int; T = int]’ is
protected within this context
13 | int main() { void (Child::*methodPtr)() = &Child::someFunc; }
| ^~~~~~~~
blubb.cpp:5:8: note: declared protected here
5 | void someFunc() {}
| ^~~~~~~~
```
## Compiler Version
```
gcc --version
gcc (GCC) 11.1.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
## System
```
uname -a
Linux 5.16.8-arch1-1 #1 SMP PREEMPT Tue, 08 Feb 2022 21:21:08 +0000 x86_64
GNU/Linux
```
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/104488] Wrong access specification in method pointer assignment
2022-02-10 15:02 [Bug c++/104488] New: Wrong access specification in method pointer assignment me at elchris dot org
@ 2022-02-10 16:56 ` redi at gcc dot gnu.org
2022-02-10 22:03 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2022-02-10 16:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104488
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Keywords| |rejects-valid
Last reconfirmed| |2022-02-10
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
There is no assignment here, that's initialization.
Reduced:
class Parent {
protected:
template <typename R = void>
void someFunc() {}
};
struct Child : Parent {
using Parent::someFunc;
};
void (Child::*methodPtr)() = &Child::someFunc;
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/104488] Wrong access specification in method pointer assignment
2022-02-10 15:02 [Bug c++/104488] New: Wrong access specification in method pointer assignment me at elchris dot org
2022-02-10 16:56 ` [Bug c++/104488] " redi at gcc dot gnu.org
@ 2022-02-10 22:03 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-10 22:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104488
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|NEW |RESOLVED
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
An almost exact Dup of bug 63532.
*** This bug has been marked as a duplicate of bug 63532 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-10 22:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 15:02 [Bug c++/104488] New: Wrong access specification in method pointer assignment me at elchris dot org
2022-02-10 16:56 ` [Bug c++/104488] " redi at gcc dot gnu.org
2022-02-10 22:03 ` pinskia 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).