News for hackers. Stuff that matters.
Re:Constexpr-8cc: Compile-time C Compiler by int_19h on Saturday November 19, 2016 @02:49AM (#12992509)
The problem with C++ grammar is that inside templates, things are too flexible at times. For example:

    template<bool> struct a_t;

    template<> struct a_t<true> {
        template<int> struct b {};
    };

    template<> struct a_t<false> {
        enum { b };
    };

    typedef a_t<sizeof(void*)==sizeof(int)> a;

    enum { c, d };
    int main() {
        a::b<c>d; // declaration or expression?
    }
It's a fun C++ IDE torture test, which few pass. One that does is Visual Studio - if you create a C++ project and set up both 32-bit and 64-bit build targets, you can flip between them, and see the syntax highlighting change on the line with the comment.

There are no comments on this comment yet.