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.heckenb...@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

Reply via email to