• Source
    1. #include <iostream>
    2. using namespace std;
    3.  
    4. struct A {
    5. A(int i) {}
    6. };
    7.  
    8. struct B {
    9. explicit B(int i) {}
    10. };
    11.  
    12. int main() {
    13. A a1 = 1;
    14. A a2(2);
    15.  
    16. // B b1 = 3; // error: conversion from 'int' to non-scalar type 'B' requested
    17. B b2(4);
    18.  
    19. return 0;
    20. }