public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110690] New: invalid use of member 'S::m' in static member function
@ 2023-07-16 15:36 irip at qq dot com
2023-07-16 16:45 ` [Bug c++/110690] " pinskia at gcc dot gnu.org
2023-07-16 16:45 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: irip at qq dot com @ 2023-07-16 15:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110690
Bug ID: 110690
Summary: invalid use of member 'S::m' in static member function
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: irip at qq dot com
Target Milestone: ---
Test Code:
struct S {
int m;
static void f_sizeof() { (void) sizeof(m); }
static void f_typeid() { (void) typeid(decltype(m)); }
struct N {
int m;
static void f_sizeof() { (void) sizeof(m); }
static void f_typeid() { (void) typeid(decltype(m)); }
};
template <class T> class C {
public:
int m;
static void f_sizeof() { (void) sizeof(m); }
static void f_typeid() { (void) typeid(decltype(m)); }
};
} s;
static void f_typeid() { (void) typeid(m); }
Compiler error:invalid use of member 'S::m' in static member function
The reason is that typeid's operand may or may not be an unevaluated operand,
so it is not known which one it is at parsing time
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/110690] invalid use of member 'S::m' in static member function
2023-07-16 15:36 [Bug c++/110690] New: invalid use of member 'S::m' in static member function irip at qq dot com
@ 2023-07-16 16:45 ` pinskia at gcc dot gnu.org
2023-07-16 16:45 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-16 16:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110690
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is the proper testcase:
```
#include <typeinfo>
struct S {
int m;
static void f_sizeof() { (void) sizeof(m); }
static void f_typeid() { (void) typeid(decltype(m)); }
struct N {
int m;
static void f_sizeof() { (void) sizeof(m); }
static void f_typeid() { (void) typeid(decltype(m)); }
};
template <class T> class C {
public:
int m;
static void f_sizeof() { (void) sizeof(m); }
static void f_typeid() { (void) typeid(decltype(m)); }
};
} s;
static void f_typeid() { (void) typeid(S::m); }
```
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/110690] invalid use of member 'S::m' in static member function
2023-07-16 15:36 [Bug c++/110690] New: invalid use of member 'S::m' in static member function irip at qq dot com
2023-07-16 16:45 ` [Bug c++/110690] " pinskia at gcc dot gnu.org
@ 2023-07-16 16:45 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-16 16:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110690
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 68604.
*** This bug has been marked as a duplicate of bug 68604 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-16 16:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-16 15:36 [Bug c++/110690] New: invalid use of member 'S::m' in static member function irip at qq dot com
2023-07-16 16:45 ` [Bug c++/110690] " pinskia at gcc dot gnu.org
2023-07-16 16:45 ` 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).