lundi 29 décembre 2014

Why do I get a compilation error with this declaration? [duplicate]


This question already has an answer here:




I can't understand why I get this error with the GCC compiler:



#include <string>
using namespace std;

void main()
{
string s();
s = "wtf";
return 0;
}

// output: error: non-object type 'std::string ()' is not assignable




Yes, yes, fine, I was after 30 Minutes or Less. Didn't go so well.


But since you're all keen to point out that I know what I'm talking about in reality, you should read up on the most vexing parse because this is not it!!


Aucun commentaire:

Enregistrer un commentaire