public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95179] New: explicit constructor not used for static inline member
@ 2020-05-17 20:13 f.heckenbach@fh-soft.de
2020-05-17 23:43 ` [Bug c++/95179] " mpolacek at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: f.heckenbach@fh-soft.de @ 2020-05-17 20:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95179
Bug ID: 95179
Summary: explicit constructor not used for static inline member
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: f.heckenbach@fh-soft.de
Target Milestone: ---
GCC refuses to use the explicit constructor for "c" below, while it does use it
for "a" and "b". (It compiles without "explicit".)
% cat test.cpp
struct S
{
explicit S () { }
};
S a; // OK
static inline S b; // OK
struct T
{
static inline S c; // fails
};
int main ()
{
}
% g++ --std=c++17 test.cpp
test.cpp:11:19: error: no matching function for call to 'S::S()'
11 | static inline S c; // fails
| ^
test.cpp:1:8: note: candidate: 'constexpr S::S(const S&)'
1 | struct S
| ^
test.cpp:1:8: note: candidate expects 1 argument, 0 provided
test.cpp:1:8: note: candidate: 'constexpr S::S(S&&)'
test.cpp:1:8: note: candidate expects 1 argument, 0 provided
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/95179] explicit constructor not used for static inline member
2020-05-17 20:13 [Bug c++/95179] New: explicit constructor not used for static inline member f.heckenbach@fh-soft.de
@ 2020-05-17 23:43 ` mpolacek at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-17 23:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95179
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
CC| |mpolacek at gcc dot gnu.org
Keywords| |rejects-valid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2020-05-17
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed. The problem is that grokfield calls finish_static_data_member_decl
with LOOKUP_IMPLICIT, and that implies LOOKUP_ONLYCONVERTING, so we skip the
explicit ctor.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-17 23:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-17 20:13 [Bug c++/95179] New: explicit constructor not used for static inline member f.heckenbach@fh-soft.de
2020-05-17 23:43 ` [Bug c++/95179] " mpolacek 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).