fork download
  1. #include <iostream>
  2.  
  3. auto f(int x) {
  4. class Unnameable {
  5. public:
  6. int getval() { return x; }
  7. };
  8. return Unnameable();
  9. }
  10.  
  11. int main() {
  12. auto var = f(125);
  13. using voldemor_t = decltype(var);
  14. int x = 56;
  15. auto harbinger = new voldemor_t();
  16. std::cerr << harbinger->getval() << "\n";
  17. return 0;
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In member function 'int f(int)::Unnameable::getval()':
prog.cpp:6:30: error: use of parameter from containing function
        int getval() { return x; }
                              ^
prog.cpp:3:12: note: 'int x' declared here
 auto f(int x) {
            ^
stdout
Standard output is empty