Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/obj-c++.dg/encode-9.mm @ 144:8f4e72ab4e11
fix segmentation fault caused by nothing next cur_op to end
author | Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 23 Dec 2018 21:23:56 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
/* Test than @encode is properly instantiated. */ /* { dg-options "-lobjc" } */ /* { dg-do run } */ #include <string.h> #include <stdlib.h> #include <objc/objc.h> template<typename T> class typeOf { public: operator const char*() { return @encode(T); } }; int main() { typeOf<int> t; if (strcmp ((const char *)t, @encode(int))) abort(); typeOf<const char*> c; if (strcmp ((const char *)c, @encode(const char*))) abort(); return 0; }