Does G++ compile it?
With only a filename on the command line of 
 g++ (Gentoo 9.3.0 p2) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.Run on an x86_64 machine.
- 
int main() {
 <%"\?"<:0:>;%>
 }
 Yes Once the C99 digraphs are simplified, the line reads{"\?"[0];}which is equivalent to simply '?';.
- 
int main() {
 char file_pattern[] = "all-??-of-20";
 }
 Yes ??- is a C trigraph which, by default, is treated as normal text with a warning.src/trigraph.cc:2:30: warning: trigraph ??- ignored, use -trigraphs to enable [-Wtrigraphs] 2 | char file_pattern[] = "all-??-of-20"; |
- 
int main() {
 int x,y=x?:y;
 }
 Yes A GCC extension allows omitting the middle operand of a conditional. If the condition is true, the condition is returned.
- 
#define assert(a) FOO
 #include <assert.h>
 #undef assert
 #include <assert.h>
 
 int main() {
 assert(0);
 }
 Yes ISO C99 Standard: 7.2 Diagnostics specifies that assert is redefined every time assert.h is included. Mostly this is to allow defining NDEBUG after the first inclusion of assert.h.
- 
#define foo bar
 #define foo bar
 int main() {}
 Yes
- 
#define b a
 #define c b
 #define c a
 int main() {}
 Yessrc/define_indirect.cc:3: warning: "c" redefined 3 | #define c a | src/define_indirect.cc:2: note: this is the location of the previous definition 2 | #define c b |
- 
#define a b
 #define b a
 int main() {
 int a, b;
 }
 Yes
- 
class Bar {};
 Bar Bar();
 int main() {}
 Yes
- 
class Bar {};
 Bar Bar;
 int main() {}
 Yes
- 
class Bar {};
 typedef Bar Bar;
 int main() {}
 Yes
- 
typedef int int;
 int main() {}
 Nosrc/int_typedef.cc:1:13: error: multiple types in one declaration 1 | typedef int int; | ^~~ src/int_typedef.cc:1:13: error: declaration does not declare anything [-fpermissive]
- 
int main() {
 int i();
 return i;
 }
 No For C compatibility, i is interpreted as a function declaration.src/int_init.cc: In function ‘int main()’: src/int_init.cc:3:10: error: invalid conversion from ‘int (*)()’ to ‘int’ [-fpermissive] 3 | return i; | ^ | | | int (*)()
- 
int i = 08;
 int main() {}
 No A leading 0 introduces an octal number. 8 is not octal.src/int_number.cc:1:9: error: invalid digit "8" in octal constant 1 | int i = 08; | ^~
- 
int i = i;
 int main() {}
 Yes
- 
int main() {
 int i, j;
 (+ +i+++ + ++++j);
 }
 Yes Read as +(+(i++)) + +(++++j). The pluses before i are unary + and do nothing. The the third + after i is actually binary addition.
- 
int main() { int i; i++++; }
 Nosrc/plus_post2.cc: In function ‘int main()’: src/plus_post2.cc:1:24: error: lvalue required as increment operand 1 | int main() { int i; i++++; } | ^~
- 
int main() { int i; ++i++; }
 Nosrc/plus_prepost.cc: In function ‘int main()’: src/plus_prepost.cc:1:24: error: lvalue required as increment operand 1 | int main() { int i; ++i++; } | ^~
- 
#include <algorithm>
 int main() {
 int a;
 unsigned int b = 0;
 return std::max(a, b);
 }
 No Typical type matching requirement of C++. Use std::max<int> instead.src/max.cc: In function ‘int main()’: src/max.cc:5:23: error: no matching function for call to ‘max(int&, unsigned int&)’ 5 | return std::max(a, b); | ^ In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/algorithm:61, from src/max.cc:1: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/bits/stl_algobase.h:222:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)’ 222 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/bits/stl_algobase.h:222:5: note: template argument deduction/substitution failed: src/max.cc:5:23: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘unsigned int’) 5 | return std::max(a, b); | ^ In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/algorithm:61, from src/max.cc:1: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/bits/stl_algobase.h:268:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 268 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/bits/stl_algobase.h:268:5: note: template argument deduction/substitution failed: src/max.cc:5:23: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘unsigned int’) 5 | return std::max(a, b); | ^ In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/algorithm:62, from src/max.cc:1: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/bits/stl_algo.h:3456:5: note: candidate: ‘template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)’ 3456 | max(initializer_list<_Tp> __l) | ^~~ /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/bits/stl_algo.h:3456:5: note: template argument deduction/substitution failed: src/max.cc:5:23: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘int’ 5 | return std::max(a, b); | ^ In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/algorithm:62, from src/max.cc:1: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/bits/stl_algo.h:3462:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)’ 3462 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/bits/stl_algo.h:3462:5: note: template argument deduction/substitution failed: src/max.cc:5:23: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘int’ 5 | return std::max(a, b); | ^
- 
int main() {
 return main();
 }
 Yes
- 
#include <vector>
 template <class T> void Foo(std::vector<T> in) {
 for (std::vector<T>::iterator i = in.begin(); i != in.end(); ++i) {}
 }
 int main() {}
 No The compiler can't tell that std::vector<T>::iterator is a type. Fix with typename std::vector<T>::iterator.src/template.cc: In function ‘void Foo(std::vector<T>)’: src/template.cc:3:8: error: need ‘typename’ before ‘std::vector<T>::iterator’ because ‘std::vector<T>’ is a dependent scope 3 | for (std::vector<T>::iterator i = in.begin(); i != in.end(); ++i) {} | ^~~ src/template.cc:3:32: error: expected ‘;’ before ‘i’ 3 | for (std::vector<T>::iterator i = in.begin(); i != in.end(); ++i) {} | ^~ | ; src/template.cc:3:49: error: ‘i’ was not declared in this scope; did you mean ‘in’? 3 | for (std::vector<T>::iterator i = in.begin(); i != in.end(); ++i) {} | ^ | in
- 
template <class T> class A {
 template <class U> class B {};
 };
 template <class V> void F() {
 typedef A<V>::B<V> T;
 }
 int main() {}
 Nosrc/template_nested1.cc: In function ‘void F()’: src/template_nested1.cc:5:11: error: need ‘typename’ before ‘A<V>::B’ because ‘A<V>’ is a dependent scope 5 | typedef A<V>::B<V> T; | ^~~~ | typename
- 
template <class T> class A {
 template <class U> class B {};
 };
 template <class V> void F() {
 typedef A<V>::template B<V> T;
 }
 int main() {}
 Nosrc/template_nested2.cc: In function ‘void F()’: src/template_nested2.cc:5:11: error: need ‘typename’ before ‘A<V>::B<V>’ because ‘A<V>’ is a dependent scope 5 | typedef A<V>::template B<V> T; | ^~~~ | typename
- 
template <class T> class A {
 template <class U> class B {};
 };
 template <class V> void F() {
 typedef typename A<V>::template B<V> T;
 }
 int main() {}
 Yes
- 
template <class T> class A {
 template <class U> class B {};
 };
 template <class V> void F() {
 typedef typename A<V>::template B<V> T;
 }
 int main() {
 F<int>();
 }
 Nosrc/template_nested4.cc: In instantiation of ‘void F() [with V = int]’: src/template_nested4.cc:8:10: required from here src/template_nested4.cc:5:40: error: ‘template<class U> class A<int>::B’ is private within this context 5 | typedef typename A<V>::template B<V> T; | ^ src/template_nested4.cc:2:28: note: declared private here 2 | template <class U> class B {}; | ^
- 
template <unsigned size> unsigned OptimizedStrlen(const char value[size]) {
 return size;
 }
 int main() {
 OptimizedStrlen("value");
 }
 Nosrc/template_array.cc: In function ‘int main()’: src/template_array.cc:5:26: error: no matching function for call to ‘OptimizedStrlen(const char [6])’ 5 | OptimizedStrlen("value"); | ^ src/template_array.cc:1:35: note: candidate: ‘template<unsigned int size> unsigned int OptimizedStrlen(const char*)’ 1 | template <unsigned size> unsigned OptimizedStrlen(const char value[size]) { | ^~~~~~~~~~~~~~~ src/template_array.cc:1:35: note: template argument deduction/substitution failed: src/template_array.cc:5:26: note: couldn’t deduce template parameter ‘size’ 5 | OptimizedStrlen("value"); | ^
- 
template <unsigned size> unsigned OptimizedStrlen(const char (&value)[size]) {
 return size;
 }
 int main() {
 OptimizedStrlen("value");
 }
 Yes discussion
- 
template <class S> struct A {
 template <class T> static void f() {}
 };
 template <class T> void g() {
 A<T>::f<T>();
 }
 int main() {}
 Nosrc/template_member.cc: In function ‘void g()’: src/template_member.cc:5:12: error: expected primary-expression before ‘>’ token 5 | A<T>::f<T>(); | ^ src/template_member.cc:5:14: error: expected primary-expression before ‘)’ token 5 | A<T>::f<T>(); | ^
- 
template <class S> struct A {
 template <class T> static void f() {}
 };
 template <class T> void g() {
 A<T>::template f<T>();
 }
 int main() {}
 Yes
- 
template <class T = unsigned int> void DoNothing() {}
 
 int main() {}
 Yes
- 
int main() {
 int a[3];
 2[a];
 }
 Yes foo[bar] is equivalent to *(foo + bar).
- 
class Foo {
 virtual void Bar() = 0;
 };
 void Foo::Bar() {}
 int main() {}
 Yes
- 
class Foo {
 virtual void Bar() = 0;
 void Bar() {}
 };
 int main() {}
 Nosrc/virtual2.cc:3:8: error: ‘void Foo::Bar()’ cannot be overloaded with ‘virtual void Foo::Bar()’ 3 | void Bar() {} | ^~~ src/virtual2.cc:2:16: note: previous declaration ‘virtual void Foo::Bar()’ 2 | virtual void Bar() = 0; | ^~~
- 
int main() {
 char a;
 switch(a) {
 case 0 ... 2:
 break;
 }
 }
 Yes Extension
- 
int main() {
 (1, "foo");
 }
 Yes
- 
#include <vector>
 namespace foo {
 struct Bar {};
 }
 int main() {
 std::vector<::foo::Bar> baz;
 }
 Yes
- 
#include <immintrin.h>
 __attribute__((target("avx512vnni"))) void VNNI8(__m512i &c, __m512i a, __m512i b) {
 asm ("vpdpbusds %2, %1, %0" : "+x"(c) : "x"(a), "mx"(b));
 }
 int main() {}
 
 Yes
- 
#include <immintrin.h>
 __attribute__((target("avx512f"))) void Scatter(int *data) {
 _mm512_i32scatter_epi32(data, _mm512_set1_epi32(1), _mm512_set1_epi32(1), 1);
 }
 
 int main() {}
 Yes
- 
#include <immintrin.h>
 __attribute__((target("avx512f"))) void Scatter(int *data) {
 _mm512_i32scatter_epi32(data - 1, _mm512_set1_epi32(1), _mm512_set1_epi32(1), 1);
 }
 
 int main() {}
 Yes but it triggers a GCC bugIn file included from /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/immintrin.h:55, from src/intrin2.cc:1: src/intrin2.cc: In function ‘void Scatter(int*)’: src/intrin2.cc:3:32: warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith] 3 | _mm512_i32scatter_epi32(data - 1, _mm512_set1_epi32(1), _mm512_set1_epi32(1), 1); | ^
- 
#include <immintrin.h>
 __attribute__((target("avx512f"))) void Scatter(int *data) {
 _mm512_i32scatter_epi32((data - 1), _mm512_set1_epi32(1), _mm512_set1_epi32(1), 1);
 }
 
 int main() {}
 Yes
- 
#include <immintrin.h>
 template <class S, class T> int *Data();
 
 __attribute__((target("avx512f"))) void Scatter(int *data) {
 _mm512_i32scatter_epi32(Data<S, T>(), _mm512_set1_epi32(1), _mm512_set1_epi32(1), 1);
 }
 
 int main() {}
 No When compiled without optimization, it's a macrosrc/intrin4.cc:5:86: error: macro "_mm512_i32scatter_epi32" passed 5 arguments, but takes just 4 5 | _mm512_i32scatter_epi32(Data<S, T>(), _mm512_set1_epi32(1), _mm512_set1_epi32(1), 1); | ^ In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/immintrin.h:55, from src/intrin4.cc:1: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/avx512fintrin.h:10470: note: macro "_mm512_i32scatter_epi32" defined here 10470 | #define _mm512_i32scatter_epi32(ADDR, INDEX, V1, SCALE) \ | src/intrin4.cc: In function ‘void Scatter(int*)’: src/intrin4.cc:5:3: error: ‘_mm512_i32scatter_epi32’ was not declared in this scope 5 | _mm512_i32scatter_epi32(Data<S, T>(), _mm512_set1_epi32(1), _mm512_set1_epi32(1), 1); | ^~~~~~~~~~~~~~~~~~~~~~~
- 
int (*main)() = 0;
 Nosrc/main_variable.cc:1:13: error: cannot declare ‘::main’ to be a global variable 1 | int (*main)() = 0; | ^
- 
int main() {
 return compl 1;
 }
 
- 
int main() {
 return ("foo", 1);
 }
 Yes
- 
template <class T> struct TypeToInt;
 
 template <> struct TypeToInt<int> {
 static const int kConst = 1;
 };
 
 int main() {
 return TypeToInt<int>::kConst;
 }
 Yes
- 
template <class S, class T> void DoNothing() {}
 template <class S> void DoNothing<S, int>() {}
 int main() {}
 Nosrc/template_partial.cc:2:43: error: non-class, non-variable partial specialization ‘DoNothing<S, int>’ is not allowed 2 | template <class S> void DoNothing<S, int>() {} | ^
- 
template <int... A> void Test() {
 int a[] = {A...};
 }
 int main() {}
 Yes
- 
template <int... A> void Test() {
 int a[] = {A...};
 }
 int main() {
 Test<>();
 }
 Yes Language extension allowing zero-length arrays.
- 
template <int... A> void Test() {
 A...;
 }
 int main() {}
 Nosrc/variadic3.cc: In function ‘void Test()’: src/variadic3.cc:2:4: error: expected ‘;’ before ‘...’ token 2 | A...; | ^~~ | ; src/variadic3.cc:2:7: error: parameter packs not expanded with ‘...’: 2 | A...; | ^ src/variadic3.cc:2:7: note: ‘A’
- 
void Foo(int) {}
 void Test() {
 Foo((1,2));
 }
 int main() {}
 Yes
- 
void Foo(int) {}
 template <int... A> void Test() {
 Foo((A...));
 }
 int main() {}
 Nosrc/variadic5.cc: In function ‘void Test()’: src/variadic5.cc:3:12: error: expected binary operator before ‘)’ token 3 | Foo((A...)); | ^
- 
void Foo(int) {}
 template <int... A> void Test() {
 Foo((A... + 1));
 }
 int main() {}
 Nosrc/variadic6.cc: In function ‘void Test()’: src/variadic6.cc:3:15: error: operand of fold expression has no unexpanded parameter packs 3 | Foo((A... + 1)); | ^
Thanks to the contributors.  Contact me (address at top) to contribute or if you actually want your name attached.