Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.old-deja/g++.mike/p2855.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 04ced10e8804 |
children |
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; | |
145 | 19 char* temp = (char *)obj; // { dg-error "16:invalid cast" } |
111 | 20 temp[0] = '\0'; |
21 } |