fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int a = 10;
  7.  
  8. /*
  9.   double &x = (double)a; // ERROR!
  10.   cout << x << endl;
  11. */
  12.  
  13. const double &x2 = (double)a; // OK!
  14. cout << x2 << endl;
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0s 4748KB
stdin
Standard input is empty
stdout
10