Compiler showing 'pi' symbol on error

C++Coliru

C++ Problem Overview


I was testing some code on Coliru, and I got a strange output. I went down the code and could reproduce it with this simple piece of code:

int main()
{
    π
}

The output on g++:

output on g++

clang:

output on clang

For instance, using just pi (without the address-of) shows the expected result:

main.cpp:3:5: error: 'pi' was not declared in this scope
    pi;
    ^

I tried to reproduce this on my machine, using g++ 4.9.2 and on others sites but I could not.

Is this some bug on this site, some config of these compilers ?

And why only using the address-of operator (&) shows this symbol ?

C++ Solutions


Solution 1 - C++

It's a bug on the site, as the compiler's output is not properly escaped. The compiler should output π, but that's valid HTML, producing the pi symbol you see.

Solution 2 - C++

π is html code for π. It looks like someone forgot to escape things properly.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionhlscalonView Question on Stackoverflow
Solution 1 - C++PuppyView Answer on Stackoverflow
Solution 2 - C++user1084944View Answer on Stackoverflow