https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113884
--- Comment #9 from Jason Liam ---
(In reply to Andrew Pinski from comment #8)
Does that imply that following program is also invalid? GCC rejects the below
program but msvc accepts.
```
struct A
{
explicit A(int = 10);
A()= default;
};
A
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113884
--- Comment #8 from Andrew Pinski ---
(In reply to Jason Liam from comment #7)
> (In reply to Andrew Pinski from comment #5)
> > std::vector 's constructor which takes std::size_t is marked as explicit.
>
> But you're missing that the
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113884
--- Comment #7 from Jason Liam ---
(In reply to Andrew Pinski from comment #5)
> std::vector 's constructor which takes std::size_t is marked as explicit.
But you're missing that the initializer list ctor is preferred/choosen over the
size_t
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113884
--- Comment #6 from Andrew Pinski ---
I know cppreference is not the standard but it is a decent reference to start
with.
https://en.cppreference.com/w/cpp/container/vector/vector
Without the explicit, clang will also reject it as being
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113884
--- Comment #5 from Andrew Pinski ---
(In reply to Jason Liam from comment #4)
> But which constructor is explicit here? I don't see any explicit ctor here.
std::vector 's constructor which takes std::size_t is marked as explicit.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113884
--- Comment #4 from Jason Liam ---
But which constructor is explicit here? I don't see any explicit ctor here.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113884
Andrew Pinski changed:
What|Removed |Added
Resolution|--- |DUPLICATE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113884
--- Comment #2 from Andrew Pinski ---
(In reply to Andrew Pinski from comment #1)
> Reduced to:
> ```
> struct B
> {
> B(double);
> };
>
> struct C
> {
> C(int);
> };
>
>
> void func(B);
> void func(C);
>
> int main() {
> func({ 4.2
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113884
--- Comment #1 from Andrew Pinski ---
Reduced to:
```
struct B
{
B(double);
};
struct C
{
C(int);
};
void func(B);
void func(C);
int main() {
func({ 4.2 });
}
```