brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1022 B · 9e234ca Raw
36 lines · cpp
1// RUN: %clang_cc1 -triple i686 -fsyntax-only -verify %s2// RUN: %clang_cc1 -triple x86_64 -fsyntax-only -verify %s3 4 5// this template, when instantiated with 300, violates the range contraint6template <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 11int		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 detectable15template <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 error21template <int N> void	testc(int value)22{23	asm("rol %1, %0" :"=r"(value): "I"(N + 1));24}25int	foo() { testc<2>(10); }26 27// these should compile without error28template <int N> bool testd()29{30  __asm goto ("" : : : : lab);31  return true;32lab:33  return false;34}35bool foox() { return testd<0> (); }36