I wrote this simple c++ code trying to solve project euler problem 3.
But it does not compiles.
With GNU GCC, compiler just hangs and neither produces any error nor ends compiling, while Clang produces some strange error messages.
||=== Build: Debug in Euler3 (compiler: LLVM Clang Compiler) ===|
/home/user/Documents/Programs/C++/ProjectEuler/Euler3/main.cpp|18|current parser token 'void'|
/home/user/Documents/Programs/C++/ProjectEuler/Euler3/main.cpp|7|LLVM IR generation of declaration 'main'|
/home/user/Documents/Programs/C++/ProjectEuler/Euler3/main.cpp|7|Generating code for declaration 'main'|
||error: unable to execute command: Aborted|
||error: clang frontend command failed due to signal (use -v to see invocation)|
||note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.|
||note: diagnostic msg: |
||note: diagnostic msg: /tmp/main-a90698.cpp|
||note: diagnostic msg: /tmp/main-a90698.sh|
||note: diagnostic msg: |
||=== Build failed: 5 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

Code:
#include <iostream>

using namespace std;

void sieve(bool [], long int N);

int main()
{
    const long int N = 600851475143L;
    bool primes[N] = {false};
    sieve(primes, N);
    long i;
    for(i = N / 2 + 1; !(primes[i] && N % i == 0) ; --i );
    cout<<i<<endl;
    return 0;
}

void sieve(bool primes[], long int N)
{
    for(long int i = 2; i<N; ++i)
    {
        if(!primes[i])
        {
            primes[i] = true;
            for(long int j = i * i; j<N ; j += i)
                primes[j] = true;
        }
    }
}