Home | History | Annotate | Download | only in Sema
      1 // RUN: %clang_cc1 -triple i686 -fsyntax-only -verify %s
      2 // RUN: %clang_cc1 -triple x86_64 -fsyntax-only -verify %s
      3 
      4 
      5 // this template, when instantiated with 300, violates the range contraint
      6 template <int N> void	test(int value)
      7 {
      8   asm("rol %1, %0" :"=r"(value): "I"(N + 1)); // expected-error{{value '301' out of range for constraint 'I'}}
      9 }
     10 
     11 int		main() { test<300>(10); } // expected-note{{in instantiation of function template specialization 'test<300>' requested here}}
     12 
     13 
     14 // this template is not used, but the error is detectable
     15 template <int N> void	testb(int value)
     16 {
     17    asm("rol %1, %0" :"=r"(value): "I"(301)); // expected-error{{value '301' out of range for constraint 'I'}}
     18 }
     19 
     20 // these should compile without error
     21 template <int N> void	testc(int value)
     22 {
     23 	asm("rol %1, %0" :"=r"(value): "I"(N + 1));
     24 }
     25 int	foo() { testc<2>(10); }
     26