I read this question that explains how anonymous variables are invalid in C++.
But the following program compiles without any warning or errors on GCC 7.2 (even with -Wall
) - demo :
int main() {
int (*); // anonymous variable?
}
Here, this is apparently also an integer type anonymous variable. So, why GCC does not show any errors or warnings? Is this a GCC bug?
There have been bugs recorded with gcc and how it detects variables for example I was using it to compile a simple program and it gave an error saying variable may be uninitialized when it have been. It is just a bug in the compiler. For example see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55985
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.