diff options
Diffstat (limited to 'test/Sema')
-rw-r--r-- | test/Sema/asm.c | 35 | ||||
-rw-r--r-- | test/Sema/overloadable.c | 20 |
2 files changed, 45 insertions, 10 deletions
diff --git a/test/Sema/asm.c b/test/Sema/asm.c index e49a1663a8968..04b7cb19eb83a 100644 --- a/test/Sema/asm.c +++ b/test/Sema/asm.c @@ -160,6 +160,41 @@ double test15() { return ret; } +void iOutputConstraint(int x){ + __asm ("nop" : "=ir" (x) : :); // no-error + __asm ("nop" : "=ri" (x) : :); // no-error + __asm ("nop" : "=ig" (x) : :); // no-error + __asm ("nop" : "=im" (x) : :); // no-error + __asm ("nop" : "=imr" (x) : :); // no-error + __asm ("nop" : "=i" (x) : :); // expected-error{{invalid output constraint '=i' in asm}} + __asm ("nop" : "+i" (x) : :); // expected-error{{invalid output constraint '+i' in asm}} + __asm ("nop" : "=ii" (x) : :); // expected-error{{invalid output constraint '=ii' in asm}} + __asm ("nop" : "=nr" (x) : :); // no-error + __asm ("nop" : "=rn" (x) : :); // no-error + __asm ("nop" : "=ng" (x) : :); // no-error + __asm ("nop" : "=nm" (x) : :); // no-error + __asm ("nop" : "=nmr" (x) : :); // no-error + __asm ("nop" : "=n" (x) : :); // expected-error{{invalid output constraint '=n' in asm}} + __asm ("nop" : "+n" (x) : :); // expected-error{{invalid output constraint '+n' in asm}} + __asm ("nop" : "=nn" (x) : :); // expected-error{{invalid output constraint '=nn' in asm}} + __asm ("nop" : "=Fr" (x) : :); // no-error + __asm ("nop" : "=rF" (x) : :); // no-error + __asm ("nop" : "=Fg" (x) : :); // no-error + __asm ("nop" : "=Fm" (x) : :); // no-error + __asm ("nop" : "=Fmr" (x) : :); // no-error + __asm ("nop" : "=F" (x) : :); // expected-error{{invalid output constraint '=F' in asm}} + __asm ("nop" : "+F" (x) : :); // expected-error{{invalid output constraint '+F' in asm}} + __asm ("nop" : "=FF" (x) : :); // expected-error{{invalid output constraint '=FF' in asm}} + __asm ("nop" : "=Er" (x) : :); // no-error + __asm ("nop" : "=rE" (x) : :); // no-error + __asm ("nop" : "=Eg" (x) : :); // no-error + __asm ("nop" : "=Em" (x) : :); // no-error + __asm ("nop" : "=Emr" (x) : :); // no-error + __asm ("nop" : "=E" (x) : :); // expected-error{{invalid output constraint '=E' in asm}} + __asm ("nop" : "+E" (x) : :); // expected-error{{invalid output constraint '+E' in asm}} + __asm ("nop" : "=EE" (x) : :); // expected-error{{invalid output constraint '=EE' in asm}} +} + // PR19837 struct foo { int a; diff --git a/test/Sema/overloadable.c b/test/Sema/overloadable.c index 49d8085651d4d..be9b862f2934f 100644 --- a/test/Sema/overloadable.c +++ b/test/Sema/overloadable.c @@ -106,8 +106,8 @@ void fn_type_conversions() { void foo(char *c) __attribute__((overloadable)); void (*ptr1)(void *) = &foo; void (*ptr2)(char *) = &foo; - void (*ambiguous)(int *) = &foo; // expected-error{{initializing 'void (*)(int *)' with an expression of incompatible type '<overloaded function type>'}} expected-note@105{{candidate function}} expected-note@106{{candidate function}} - void *vp_ambiguous = &foo; // expected-error{{initializing 'void *' with an expression of incompatible type '<overloaded function type>'}} expected-note@105{{candidate function}} expected-note@106{{candidate function}} + void (*ambiguous)(int *) = &foo; // expected-error{{initializing 'void (*)(int *)' with an expression of incompatible type '<overloaded function type>'}} expected-note@-4{{candidate function}} expected-note@-3{{candidate function}} + void *vp_ambiguous = &foo; // expected-error{{initializing 'void *' with an expression of incompatible type '<overloaded function type>'}} expected-note@-5{{candidate function}} expected-note@-4{{candidate function}} void (*specific1)(int *) = (void (*)(void *))&foo; // expected-warning{{incompatible function pointer types initializing 'void (*)(int *)' with an expression of type 'void (*)(void *)'}} void *specific2 = (void (*)(void *))&foo; @@ -117,8 +117,8 @@ void fn_type_conversions() { void disabled(char *c) __attribute__((overloadable, enable_if(1, "The function name lies."))); // To be clear, these should all point to the last overload of 'disabled' void (*dptr1)(char *c) = &disabled; - void (*dptr2)(void *c) = &disabled; // expected-warning{{incompatible pointer types initializing 'void (*)(void *)' with an expression of type '<overloaded function type>'}} expected-note@115{{candidate function made ineligible by enable_if}} expected-note@116{{candidate function made ineligible by enable_if}} expected-note@117{{candidate function has type mismatch at 1st parameter (expected 'void *' but has 'char *')}} - void (*dptr3)(int *c) = &disabled; // expected-warning{{incompatible pointer types initializing 'void (*)(int *)' with an expression of type '<overloaded function type>'}} expected-note@115{{candidate function made ineligible by enable_if}} expected-note@116{{candidate function made ineligible by enable_if}} expected-note@117{{candidate function has type mismatch at 1st parameter (expected 'int *' but has 'char *')}} + void (*dptr2)(void *c) = &disabled; // expected-warning{{incompatible pointer types initializing 'void (*)(void *)' with an expression of type '<overloaded function type>'}} expected-note@-5{{candidate function made ineligible by enable_if}} expected-note@-4{{candidate function made ineligible by enable_if}} expected-note@-3{{candidate function has type mismatch at 1st parameter (expected 'void *' but has 'char *')}} + void (*dptr3)(int *c) = &disabled; // expected-warning{{incompatible pointer types initializing 'void (*)(int *)' with an expression of type '<overloaded function type>'}} expected-note@-6{{candidate function made ineligible by enable_if}} expected-note@-5{{candidate function made ineligible by enable_if}} expected-note@-4{{candidate function has type mismatch at 1st parameter (expected 'int *' but has 'char *')}} void *specific_disabled = &disabled; } @@ -131,14 +131,14 @@ void incompatible_pointer_type_conversions() { void foo(char *c) __attribute__((overloadable)); void foo(short *c) __attribute__((overloadable)); foo(charbuf); - foo(ucharbuf); // expected-error{{call to 'foo' is ambiguous}} expected-note@131{{candidate function}} expected-note@132{{candidate function}} - foo(intbuf); // expected-error{{call to 'foo' is ambiguous}} expected-note@131{{candidate function}} expected-note@132{{candidate function}} + foo(ucharbuf); // expected-error{{call to 'foo' is ambiguous}} expected-note@-3{{candidate function}} expected-note@-2{{candidate function}} + foo(intbuf); // expected-error{{call to 'foo' is ambiguous}} expected-note@-4{{candidate function}} expected-note@-3{{candidate function}} void bar(unsigned char *c) __attribute__((overloadable)); void bar(signed char *c) __attribute__((overloadable)); - bar(charbuf); // expected-error{{call to 'bar' is ambiguous}} expected-note@137{{candidate function}} expected-note@138{{candidate function}} + bar(charbuf); // expected-error{{call to 'bar' is ambiguous}} expected-note@-2{{candidate function}} expected-note@-1{{candidate function}} bar(ucharbuf); - bar(intbuf); // expected-error{{call to 'bar' is ambiguous}} expected-note@137{{candidate function}} expected-note@138{{candidate function}} + bar(intbuf); // expected-error{{call to 'bar' is ambiguous}} expected-note@-4{{candidate function}} expected-note@-3{{candidate function}} } void dropping_qualifiers_is_incompatible() { @@ -148,8 +148,8 @@ void dropping_qualifiers_is_incompatible() { void foo(char *c) __attribute__((overloadable)); void foo(const volatile unsigned char *c) __attribute__((overloadable)); - foo(ccharbuf); // expected-error{{call to 'foo' is ambiguous}} expected-note@148{{candidate function}} expected-note@149{{candidate function}} - foo(vcharbuf); // expected-error{{call to 'foo' is ambiguous}} expected-note@148{{candidate function}} expected-note@149{{candidate function}} + foo(ccharbuf); // expected-error{{call to 'foo' is ambiguous}} expected-note@-3{{candidate function}} expected-note@-2{{candidate function}} + foo(vcharbuf); // expected-error{{call to 'foo' is ambiguous}} expected-note@-4{{candidate function}} expected-note@-3{{candidate function}} } // Bug: we used to treat `__typeof__(foo)` as though it was `__typeof__(&foo)` |