view gcc/testsuite/obj-c++.dg/proto-lossage-3.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

/* Crash due to descriptionFor(Instance|Class)Method applied to
   a protocol with no instance/class methods respectively.
   Problem report and original fix by richard@brainstorm.co.uk.  */
/* { dg-do run } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
#include <objc/Protocol.h>
#include "../objc-obj-c++-shared/runtime.h"

@interface MyClass
- name;
@end

@protocol NoInstanceMethods
+ testMethod;
@end

@protocol NoClassMethods
- testMethod;
@end

int
main()
{
protocol_getMethodDescription (@protocol(NoInstanceMethods), @selector(name), YES, YES);
protocol_getMethodDescription (@protocol(NoInstanceMethods), @selector(name), YES, NO);
protocol_getMethodDescription (@protocol(NoClassMethods), @selector(name), YES, YES);
protocol_getMethodDescription (@protocol(NoClassMethods), @selector(name), YES, NO);
return 0;
}