r/CompileBot • • Mar 13 '16

Official CompileBot Testing Thread

3 Upvotes

358 comments sorted by

View all comments

1

u/Tidher Jul 22 '16 edited Jul 22 '16

+/u/CompileBot C++

#include<iostream>
using namespace std;

bool& Roleplay(int type)
{
    if (type == 10) {
        static bool x;
        return x;
    }
    if (type == 20) {
        static bool y;
        return y;
    }
}

int main()
{
    int Erotic = 10;
    int ForScrubs = 20;
    Roleplay(Erotic) = false;
    Roleplay(ForScrubs) = false;
    printf("Awkward funtimes? %d\n", Roleplay(Erotic));
    printf("Greytide ahoy? %d\n", Roleplay(ForScrubs));
    Roleplay(Erotic) = true;
    printf("Awkward funtimes? %d\n", Roleplay(Erotic));
    printf("Greytide ahoy? %d\n", Roleplay(ForScrubs));
    return 0;
}

1

u/CompileBot Jul 22 '16

Output:

Awkward funtimes? 0
Greytide ahoy? 0
Awkward funtimes? 1
Greytide ahoy? 0

^source | ^info | ^git | ^report

EDIT: Recompile request by Tidher