-
-
Save anonymous/a8faec72cb1423261c86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
int main() | |
{ | |
std::string *sp = new std::string("hehe"); | |
sp->~string();//expected class-name before ‘(’ token | |
operator delete (sp); | |
return 0; | |
} | |
//----------file1----------- | |
#include <string> | |
using std::string; | |
int main() | |
{ | |
string *sp = new string("hehe"); | |
sp->~string();//通过 | |
operator delete (sp); | |
return 0; | |
} | |
//--------file2--------- | |
struct Ints { | |
int ival; | |
int ival1; | |
}; | |
int main() | |
{ | |
Ints* p = new Ints{1,2}; | |
p->~Ints(); | |
operator delete (p); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment