fork download
  1. #include <iostream>
  2.  
  3. template<size_t N>
  4. using array_of_char = char const[N];
  5.  
  6. char const a[3] = "12";
  7. array_of_char<3> b = "12";
  8.  
  9. array_of_char<3>& x = a;
  10. array_of_char<3>& y = b;
  11.  
  12. template<size_t N>
  13. using array_of_char_ref = array_of_char<N>&;
  14.  
  15.  
  16. template<size_t N>
  17. void fn(array_of_char_ref<N> x){ // error: redefinition, that's literally the same thing
  18. std::cout << x << N;
  19. }
  20.  
  21. int main() {
  22. fn(a);
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 5392KB
stdin
Standard input is empty
stdout
123