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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to