https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89901
Bug ID: 89901 Summary: carat of build error at wrong letter Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jg at jguk dot org Target Milestone: --- Could g++ indicate the carat on returned var? C++ Godbolt trunk actual: 10 | const char **a = f(); | ~^~ C++ Expected: 10 | const char **a = f(); | ~^~ #1 with x86-64 gcc (trunk) <source>: In function 'int main()': <source>:10:23: error: invalid conversion from 'char**' to 'const char**' [-fpermissive] 10 | const char **a = f(); | ~^~ | | | char** Compiler returned: 1 As "C" #1 with x86-64 gcc (trunk) <source>: In function 'main': <source>:10:22: warning: initialization of 'const char **' from incompatible pointer type 'char **' [-Wincompatible-pointer-types] 10 | const char **a = f(); | ^ Compiler returned: 0 #include <stdlib.h> char ** f() { char ** a = (char**)malloc(sizeof(char*) *4); return a; } int main() { const char **a = f(); // Take off the "const" to stop the error }