brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.1 KiB · f26b43f Raw
128 lines · c
1// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -DNOERROR %s2// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -DNOERROR %s -fexperimental-new-constant-interpreter3 4// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \5// RUN: -x c++ -DCPP -DNOERROR %s6// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \7// RUN: -x c++ -DCPP -DNOERROR %s -fexperimental-new-constant-interpreter8 9// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \10// RUN: -ffp-eval-method=double -DNOERROR %s11// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \12// RUN: -ffp-eval-method=double -DNOERROR %s -fexperimental-new-constant-interpreter13 14// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \15// RUN: -ffp-eval-method=double -DNOERROR %s16// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \17// RUN: -ffp-eval-method=double -DNOERROR %s -fexperimental-new-constant-interpreter18 19 20// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \21// RUN: -ffp-eval-method=source %s22// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \23// RUN: -ffp-eval-method=source %s -fexperimental-new-constant-interpreter24 25// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \26// RUN: -ffp-eval-method=source %s27// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \28// RUN: -ffp-eval-method=source %s -fexperimental-new-constant-interpreter29 30// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \31// RUN: -ffp-eval-method=extended %s32// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \33// RUN: -ffp-eval-method=extended %s -fexperimental-new-constant-interpreter34 35// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \36// RUN: -ffp-eval-method=extended %s37// RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \38// RUN: -ffp-eval-method=extended %s -fexperimental-new-constant-interpreter39 40#ifdef NOERROR41// expected-no-diagnostics42typedef float float_t;43typedef double double_t;44#else45#ifdef CPP46typedef float float_t; //expected-error 9 {{cannot use type 'float_t' within '#pragma clang fp eval_method'; type is set according to the default eval method for the translation unit}}47  48typedef double double_t; //expected-error 9 {{cannot use type 'double_t' within '#pragma clang fp eval_method'; type is set according to the default eval method for the translation unit}}49#else50typedef float float_t; //expected-error 7 {{cannot use type 'float_t' within '#pragma clang fp eval_method'; type is set according to the default eval method for the translation unit}}51  52typedef double double_t; //expected-error 7 {{cannot use type 'double_t' within '#pragma clang fp eval_method'; type is set according to the default eval method for the translation unit}}53#endif54#endif55 56float foo1() {57#pragma clang fp eval_method(double)58  float a;59  double b;60  return a - b;61}62  63float foo2() {64#pragma clang fp eval_method(double)65  float_t a; 66  double_t b; 67  return a - b;68}69  70void foo3() {71#pragma clang fp eval_method(double)72  char buff[sizeof(float_t)];73  char bufd[sizeof(double_t)];74  buff[1] = bufd[2];75}76  77float foo4() {78#pragma clang fp eval_method(double)79  typedef float_t FT;80  typedef double_t DT;81  FT a;82  DT b;83  return a - b;84}85  86int foo5() {87#pragma clang fp eval_method(double)88  int t = _Generic( 1.0L, float_t:1, default:0);89  int v = _Generic( 1.0L, double_t:1, default:0);90  return t;91}92 93void foo6() {94#pragma clang fp eval_method(double)95  float f = (float_t)1; 96  double d = (double_t)2; 97}98  99void foo7() {100#pragma clang fp eval_method(double)101  float c1 = (float_t)12;102  double c2 = (double_t)13;103}104  105float foo8() {106#pragma clang fp eval_method(double)107  extern float_t f;108  extern double_t g;109  return f-g;110}111 112#ifdef CPP113void foo9() {114#pragma clang fp eval_method(double)115  auto resf = [](float_t f) { return f; };116  auto resd = [](double_t g) { return g; };117}118 119void foo10() {120#pragma clang fp eval_method(double)121  using Ft = float_t;122  using Dt = double_t;123  Ft a;124  Dt b;125}126#endif127 128