2009-12-16 04:14:24 +08:00
// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
2009-05-08 01:50:16 +08:00
2012-09-12 18:45:46 +08:00
// PR13819
// REQUIRES: LP64
2009-05-08 01:50:16 +08:00
// [dcl.ambig.res]p1:
struct S {
S ( int ) ;
void bar ( ) ;
} ;
int returns_an_int ( ) ;
void foo ( double a )
{
2012-07-31 05:30:52 +08:00
S w ( int ( a ) ) ; // expected-warning{{disambiguated as a function declaration}} expected-note{{add a pair of parentheses}}
2009-05-08 01:50:16 +08:00
w ( 17 ) ;
2012-07-31 05:30:52 +08:00
S x1 ( int ( ) ) ; // expected-warning{{disambiguated as a function declaration}} expected-note{{add a pair of parentheses}}
2010-02-09 15:26:29 +08:00
x1 ( & returns_an_int ) ;
2009-05-08 01:50:16 +08:00
S y ( ( int ) a ) ;
y . bar ( ) ;
S z = int ( a ) ;
z . bar ( ) ;
}
// [dcl.ambig.res]p3:
char * p ;
void * operator new ( __SIZE_TYPE__ , int ) ;
void foo3 ( ) {
const int x = 63 ;
new ( int ( * p ) ) int ; //new-placement expression
new ( int ( * [ x ] ) ) ; //new type-id
}
// [dcl.ambig.res]p4:
template < class T > // expected-note{{here}}
struct S4 {
T * p ;
} ;
S4 < int ( ) > x ; //type-id
S4 < int ( 1 ) > y ; // expected-error{{must be a type}}
// [dcl.ambig.res]p5:
void foo5 ( )
{
( void ) sizeof ( int ( 1 ) ) ; //expression
2013-08-14 06:26:42 +08:00
( void ) sizeof ( int ( ) ) ; // expected-error{{function type}}
2009-05-08 01:50:16 +08:00
}
// [dcl.ambig.res]p6:
void foo6 ( )
{
( void ) ( int ( 1 ) ) ; //expression
2009-07-25 23:41:38 +08:00
( void ) ( int ( ) ) 1 ; // expected-error{{to 'int ()'}}
2009-05-08 01:50:16 +08:00
}
// [dcl.ambig.res]p7:
class C7 { } ;
void f7 ( int ( C7 ) ) { } // expected-note{{candidate}}
int g7 ( C7 ) ;
void foo7 ( ) {
f7 ( 1 ) ; // expected-error{{no matching function}}
f7 ( g7 ) ; //OK
}
void h7 ( int * ( C7 [ 10 ] ) ) { } // expected-note{{previous}}
void h7 ( int * ( * _fp ) ( C7 _parm [ 10 ] ) ) { } // expected-error{{redefinition}}
2009-07-22 01:05:03 +08:00
struct S5 {
static bool const value = false ;
} ;
int foo8 ( ) {
2012-07-31 05:30:52 +08:00
int v ( int ( S5 : : value ) ) ; // expected-warning{{disambiguated as a function declaration}} expected-note{{add a pair of parentheses}} expected-error{{parameter declarator cannot be qualified}}
2009-07-22 01:05:03 +08:00
}
2010-12-08 10:02:46 +08:00
template < typename T >
void rdar8739801 ( void ( T : : * ) ( void ) __attribute__ ( ( unused ) ) ) ;