int sum = 10; const int target = sum + 1; bool dp[target + 1] = {0};
Compiles fine on my g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0.