I was surprised to learn that g++ (4.9) was compiling this (while gcc would not):
#include <stdio.h>
enum
{
ONE = 1,
TWO = 2,
THREE = 3
};
int main(int argc, char* argv[])
{
int sw = 2;
switch (sw)
{
case::ONE:
{
printf("1\n");
break;
}
case::TWO:
{
printf("2\n");
break;
}
case::THREE:
{
printf("3\n");
break;
}
default:
{
printf("default\n");
}
}
}
How is the g++ preprocessor able to separate the "case" from the "::ONE:"?