[ create a new paste ] login | about

Link: http://codepad.org/ZWzFIYzY    [ raw code | output | fork ]

C++, pasted on Sep 15:
1
2
3
4
5
6
7
8
9
10
11
12
template <class T>
struct Main
{
    static Main tempFunction(){
       return Main();
    }
};

int main()
{
   Main<int> &mainReference = Main<int>::tempFunction();
}


Output:
1
2
3
In function 'int main()':
Line 11: error: invalid initialization of non-const reference of type 'Main<int>&' from a temporary of type 'Main<int>'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: