2011-09-19 05:48:27 +08:00
// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -verify -fms-compatibility -fexceptions -fcxx-exceptions
2011-09-19 05:37:37 +08:00
namespace ms_conversion_rules {
void f ( float a ) ;
void f ( int a ) ;
void test ( )
{
long a = 0 ;
f ( ( long ) 0 ) ;
f ( a ) ;
}
}
2011-09-19 05:48:27 +08:00
namespace ms_protected_scope {
struct C { C ( ) ; } ;
int jump_over_variable_init ( bool b ) {
if ( b )
goto foo ; // expected-warning {{illegal goto into protected scope}}
C c ; // expected-note {{jump bypasses variable initialization}}
foo :
return 1 ;
}
struct Y {
~ Y ( ) ;
} ;
void jump_over_var_with_dtor ( ) {
goto end ; // expected-warning{{goto into protected scope}}
Y y ; // expected-note {{jump bypasses variable initialization}}
end :
;
}
void jump_over_variable_case ( int c ) {
switch ( c ) {
case 0 :
int x = 56 ; // expected-note {{jump bypasses variable initialization}}
case 1 : // expected-error {{switch case is in protected scope}}
x = 10 ;
}
}
void exception_jump ( ) {
goto l2 ; // expected-error {{illegal goto into protected scope}}
try { // expected-note {{jump bypasses initialization of try block}}
l2 : ;
} catch ( int ) {
}
}
int jump_over_indirect_goto ( ) {
static void * ps [ ] = { & & a0 } ;
goto * & & a0 ; // expected-warning {{goto into protected scope}}
int a = 3 ; // expected-note {{jump bypasses variable initialization}}
a0 :
return 0 ;
}
}
2011-09-21 06:08:26 +08:00
namespace ms_using_declaration_bug {
class A {
public :
int f ( ) ;
} ;
class B : public A {
private :
using A : : f ;
} ;
class C : public B {
private :
using B : : f ; // expected-warning {{using declaration refers to inaccessible member 'ms_using_declaration_bug::B::f', which refers to accessible member 'ms_using_declaration_bug::A::f', accepted for Microsoft compatibility}}
} ;
}