Ich möchte wissen, welcher Compiler hier richtig ist.
Code: Select all
#include
#include
#include
struct Coord
{
int x, y;
};
template
class CoordArray
{
public:
CoordArray(const Coord(&ref)[N])
{}
};
template CoordArray() -> CoordArray;
CoordArray myCoordArray{{{2, 1}, {4, 1}, {6, 1}}}; //clang rejects but gcc and msvc accepts
CoordArray myCoordArray2{{{2, 1}, {4, 1}, {6, 1}}}; //clang rejects but gcc and msvc accepts
Code: Select all
:17:24: error: deduction guide template contains template parameters that cannot be deduced
17 | template CoordArray() -> CoordArray;
| ^
:17:14: note: non-deducible template parameter 'D'
17 | template CoordArray() -> CoordArray;
| ^
:17:21: note: non-deducible template parameter 'N'
17 | template CoordArray() -> CoordArray;
|
Mobile version