#include <stdbool.h> #include <stdio.h> bool f(int n) { typedef int A[n]; ++n; A a; int b[n]; n -= 2; typedef int C[n]; C c; return (sizeof(a) < sizeof(b)) && (sizeof(a) > sizeof(c)); } int main() { printf("%d", (int)f(10)); } If compiled as C, this program will print 1. If compiled as C++, this program will print 0. The C++ frontend seems to fail to take into account that the `typedef`'s results are calculated at runtime based on the current value of `n`.
I think this is the same bug as reported in pr68531. *** This bug has been marked as a duplicate of bug 68531 ***