struct S {
double arr[1];
S(double arr[1]) : arr(arr) {}
};
int main(void) {
double arr[1] = {1.2};
S p(arr);
return 0;
}
Hi, this is an extracted problem I encountered in my code.
Do you know why this code won't compile?
main.cpp: In constructor ‘S::S(double*)’:
main.cpp:26:28: error: incompatible types in assignment of ‘double*’ to ‘double [1]’
S(double arr[1]) : arr(arr) {}
I am using g++
, compiling and running with
g++ -std=c++17 main.cpp kdtree.h kdtree.cpp && ./a.out