enum IdType { Book, Customer }; template <IdType Type> struct Id { int m_id; }; using BookId = Id<Book>; using CustomerId = Id<Customer>; int main() { BookId book; CustomerId cust; book = cust; }
Standard input is empty
prog.cpp:18:7: error: no viable overloaded '='
book = cust;
~~~~ ^ ~~~~
prog.cpp:7:8: note: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Id<Customer aka 1>' to 'const Id<0>' for 1st argument
struct Id {
^
prog.cpp:7:8: note: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Id<Customer aka 1>' to 'Id<0>' for 1st argument
struct Id {
^
1 error generated.
Standard output is empty