python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
C++ - Why does aggregate initialization not work with template struct
This code works, without having to specify a constructor:
struct Foo
{
int a;
int b;
};
//...
int a1, b1;
Foo foo = {a1, b1};
If I make Foo a template, it doesn't work.
template<...
Newline
Votes: 0
Answers: 1
Class template argument deduction - why does it fail here?
Why does the following CTAD attempt fail to compile ?
template <typename T> struct C { C(T,T) {} };
template <> struct C<int> { C(int) {} };
C c(1); //error: template argument dedu...
user1958486
Votes: 0
Answers: 1
clang vs gcc - CTAD of struct deriving from template parameter
Consider the following code:
template <typename B>
struct D : B { };
D d{[]{ }};
gcc 12.x accepts it and deduces d to be D</* type of lambda */> as expected.
clang 14.x rejects it with...

Vittorio Romeo
Votes: 0
Answers: 1