回答編集履歴
1
m
test
CHANGED
@@ -3,3 +3,51 @@
|
|
3
3
|
|
4
4
|
|
5
5
|
`::`はグローバル名前空間にある、という意味合いですね。
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
```
|
10
|
+
|
11
|
+
#include <new>
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
int main()
|
16
|
+
|
17
|
+
{
|
18
|
+
|
19
|
+
::operator new(sizeof(int));
|
20
|
+
|
21
|
+
}
|
22
|
+
|
23
|
+
```
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
```
|
28
|
+
|
29
|
+
prog.cc: In function 'int main()':
|
30
|
+
|
31
|
+
prog.cc:5:17: warning: ignoring return value of 'void* operator new(std::size_t)', declared with attribute 'nodiscard' [-Wunused-result]
|
32
|
+
|
33
|
+
5 | ::operator new(sizeof(int));
|
34
|
+
|
35
|
+
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~
|
36
|
+
|
37
|
+
In file included from prog.cc:1:
|
38
|
+
|
39
|
+
/opt/wandbox/gcc-10.1.0/include/c++/10.1.0/new:126:26: note: declared here
|
40
|
+
|
41
|
+
126 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
|
42
|
+
|
43
|
+
| ^~~~~~~~
|
44
|
+
|
45
|
+
```
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
[https://wandbox.org/permlink/AMdyESvpojzWE8iu](https://wandbox.org/permlink/AMdyESvpojzWE8iu)
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
この警告文見たほうがわかりやすいかな?
|