KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I tried to compile the code below with Clang class Prasoon{ static const int dummy = 0; }; int const Prasoon::dummy = 0; int main(){} The above code did not give any error when compiled with Clang. prasoon@prasoon-desktop ~ $ clang++ --version clang version 2.8 (trunk 107611) Target: i386-pc-linux-gnu Thread model: posix prasoon@prasoon-desktop ~ $ cat bug.cpp class Prasoon{ private: static const int dummy = 0; }; int const Prasoon::dummy = 0; int main(){} prasoon@prasoon-desktop ~ $ clang++ bug.cpp prasoon@prasoon-desktop ~ $ But when I compiled the same code with g++ I got an error as expected. prasoon@prasoon-desktop ~ $ g++ bug.cpp bug.cpp:8: error: duplicate initialization of ‘Prasoon::dummy’ So have I found a bug in Clang ?
Tags (comma-separated)
Save Edits
Cancel