1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -std=c++11 -emit-llvm -o - | FileCheck %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc // PR5021 4*f4a2713aSLionel Sambuc namespace PR5021 { 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambuc struct A { 7*f4a2713aSLionel Sambuc virtual void f(char); 8*f4a2713aSLionel Sambuc }; 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambuc void f(A *a) { 11*f4a2713aSLionel Sambuc // CHECK: call void % 12*f4a2713aSLionel Sambuc a->f('c'); 13*f4a2713aSLionel Sambuc } 14*f4a2713aSLionel Sambuc 15*f4a2713aSLionel Sambuc struct B : virtual A { 16*f4a2713aSLionel Sambuc virtual void f(); 17*f4a2713aSLionel Sambuc }; 18*f4a2713aSLionel Sambuc 19*f4a2713aSLionel Sambuc void f(B * b) { 20*f4a2713aSLionel Sambuc b->f(); 21*f4a2713aSLionel Sambuc } 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc } 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambuc namespace Test1 { 26*f4a2713aSLionel Sambuc struct A { 27*f4a2713aSLionel Sambuc virtual ~A(); 28*f4a2713aSLionel Sambuc }; 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc struct B : A { 31*f4a2713aSLionel Sambuc virtual ~B(); 32*f4a2713aSLionel Sambuc virtual void f(); 33*f4a2713aSLionel Sambuc }; 34*f4a2713aSLionel Sambuc 35*f4a2713aSLionel Sambuc void f(B *b) { 36*f4a2713aSLionel Sambuc b->f(); 37*f4a2713aSLionel Sambuc } 38*f4a2713aSLionel Sambuc } 39*f4a2713aSLionel Sambuc 40*f4a2713aSLionel Sambuc namespace VirtualNoreturn { 41*f4a2713aSLionel Sambuc struct A { 42*f4a2713aSLionel Sambuc [[noreturn]] virtual void f(); 43*f4a2713aSLionel Sambuc }; 44*f4a2713aSLionel Sambuc 45*f4a2713aSLionel Sambuc // CHECK: @_ZN15VirtualNoreturn1f 46*f4a2713aSLionel Sambuc void f(A *p) { 47*f4a2713aSLionel Sambuc p->f(); 48*f4a2713aSLionel Sambuc // CHECK: call void %{{[^#]*$}} 49*f4a2713aSLionel Sambuc // CHECK-NOT: unreachable 50*f4a2713aSLionel Sambuc } 51*f4a2713aSLionel Sambuc } 52