[llvm-bugs] [Bug 47427] New: definition or redeclaration is not allowed inside a function
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Sep 5 07:17:34 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47427
Bug ID: 47427
Summary: definition or redeclaration is not allowed inside a
function
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: tangyixuan at mail.dlut.edu.cn
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Hi, the following code (maybe is valid ?) is rejected by clang, while is
accepted by g++.
$ cat s.cpp
namespace N {
enum E { EA };
}
struct C {
C ( N :: E ){}
int operator ()(){ return 0;}
};
int main (){ C ( N :: EA )();}
$ clang++ -c s.cpp
s.cpp:8:23: error: definition or redeclaration of 'EA' not allowed inside a
function
int main (){ C ( N :: EA )();}
~~~~ ^
s.cpp:8:27: warning: empty parentheses interpreted as a function declaration
[-Wvexing-parse]
int main (){ C ( N :: EA )();}
^~
s.cpp:8:27: note: remove parentheses to declare a variable
int main (){ C ( N :: EA )();}
^~
1 warning and 1 error generated.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200905/68417d37/attachment-0001.html>
More information about the llvm-bugs
mailing list