Debian Codegraph @

gcc/testsuite/g++.dg/pr106824.C

raw
1 // { dg-do compile }
2 // { dg-options "-O2 -w -std=c++11" }
3
4 using int32 = int;
5 int ShortestPath_distance;
6 struct FloatWeightTpl {
7 FloatWeightTpl(float f) : value_(f) {}
8 float Value() { return value_; }
9 float value_;
10 };
11 template <class T> bool operator!=(FloatWeightTpl w1, T w2) {
12 bool __trans_tmp_2;
13 FloatWeightTpl __trans_tmp_3 = w1;
14 __trans_tmp_2 = __trans_tmp_3.Value() == w2.Value();
15 return __trans_tmp_2;
16 }
17 struct TropicalWeightTpl : FloatWeightTpl {
18 TropicalWeightTpl(float f) : FloatWeightTpl(f) {}
19 static TropicalWeightTpl Zero();
20 static TropicalWeightTpl NoWeight() {
21 float __trans_tmp_5 = __builtin_nanf("");
22 return __trans_tmp_5;
23 }
24 bool Member() { return value_; }
25 };
26 TropicalWeightTpl Plus(TropicalWeightTpl w1, TropicalWeightTpl &w2) {
27 return w1.Member() || w2.Member() ? TropicalWeightTpl::NoWeight() : w2.Value() ? : w2;
28 }
29 TropicalWeightTpl Times();
30 struct ArcTpl {
31 using Weight = TropicalWeightTpl;
32 };
33 template <class, class, class> struct ShortestPathOptions {
34 ShortestPathOptions(int, int, int32, bool, bool);
35 };
36 template <class Arc, class Queue, class ArcFilter>
37 void SingleShortestPath(ShortestPathOptions<Arc, Queue, ArcFilter>) {
38 using Weight = typename Arc::Weight;
39 auto f_distance = Weight::Zero();
40 while (!0) {
41 TropicalWeightTpl __trans_tmp_1 = Times(),
42 plus = Plus(f_distance, __trans_tmp_1);
43 if (f_distance != plus)
44 f_distance = plus;
45 }
46 }
47 template <class Arc, class Queue, class ArcFilter>
48 void ShortestPath(int, int *, int *,
49 ShortestPathOptions<Arc, Queue, ArcFilter> opts) {
50 SingleShortestPath(opts);
51 }
52 struct ShortestDistanceOptions {
53 float delta;
54 };
55 struct Trans_NS_script_ShortestPathOptions : ShortestDistanceOptions {
56 int32 nshortest;
57 bool unique;
58 };
59 namespace internal {
60 template <class, class>
61 void ShortestPath(int ifst, int *ofst, int *distance,
62 Trans_NS_script_ShortestPathOptions opts) {
63 using ArcFilter = int;
64 ShortestPathOptions<ArcTpl, int, ArcFilter> sopts(opts.nshortest, opts.unique,
65 false, opts.delta, 0);
66 ShortestPath(ifst, ofst, distance, sopts);
67 }
68 int ShortestPath_ifst;
69 int ShortestPath_ofst;
70 Trans_NS_script_ShortestPathOptions ShortestPath_opts;
71 void ShortestPath() {
72 using StateId = int;
73 ShortestPath<ArcTpl, StateId>(ShortestPath_ifst, &ShortestPath_ofst,
74 &ShortestPath_distance, ShortestPath_opts);
75 }
76 } // namespace internal