Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.old-deja/g++.mike/p2855.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
rev | line source |
---|---|
111 | 1 // { dg-do assemble } |
2 // { dg-options "-Wcast-qual" } | |
3 // prms-id: 2855 | |
4 | |
5 class Ctest { | |
6 private: | |
7 char* data; | |
8 public: | |
9 operator const char *() const; | |
10 }; | |
11 | |
12 Ctest::operator const char *() const | |
13 { | |
14 return data; | |
15 } | |
16 int main() | |
17 { | |
18 Ctest obj; | |
19 char* temp = (char *)obj; // { dg-error "invalid cast" } | |
20 temp[0] = '\0'; | |
21 } |