CJCoding With Joseph
15free / daySign inCreate account
Back to Multiple Choice Quiz

Select topics to narrow your question pool, then enable Random to jump to a random question matching your filters.

Topics

Template Instantiation Failure

C++ quiz · Question 58
mediumTemplates

The following code fails to compile at the call site. Why?

#include <iostream>
using namespace std;

template <typename T>
void printSum(T a, T b) {
    cout << a + b << "\n";
}

struct Point { int x, y; };

int main() {
    printSum(Point{1,2}, Point{3,4});
}