[LLVMbugs] [Bug 7084] Incompatible functions in declarative region not being checked for overload compatibility
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Jun 27 15:43:02 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=7084
Kaelyn Uhrain <rikka at google.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |rikka at google.com
Resolution| |FIXED
--- Comment #1 from Kaelyn Uhrain <rikka at google.com> 2012-06-27 17:43:02 CDT ---
Assuming the code example is C++, clang 3.1 will give a vexing-parse warning by
default while producing a binary that runs without any problems:
$ cat tmp.cc
struct string { };
void f() { string g(); g(); }
void g() { } // diagnostic expected here
int main() { f(); }
$ clang++ -o tmp tmp.cc ; echo "clang++ exited with a status of $?"
tmp.cc:2:20: warning: empty parentheses interpreted as a function declaration
[-Wvexing-parse]
void f() { string g(); g(); }
^~
tmp.cc:2:20: note: remove parentheses to declare a variable
void f() { string g(); g(); }
^~
1 warning generated.
clang++ exited with a status of 0
$ ./tmp ; echo "./tmp exited with a status of $?"
./tmp exited with a status of 0
And for completeness, treating the example as C code yields a pair of errors:
$ clang -o tmp -x c tmp.cc
tmp.cc:2:12: error: must use 'struct' tag to refer to type 'string'
void f() { string g(); g(); }
^
struct
tmp.cc:3:6: error: conflicting types for 'g'
void g() { } // diagnostic expected here
^
tmp.cc:2:19: note: previous declaration is here
void f() { string g(); g(); }
^
2 errors generated.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list