|
| 1 | + |
| 2 | +template <class T> struct type_trait { |
| 3 | + const static bool value = false; |
| 4 | +}; |
| 5 | + |
| 6 | +template <> struct type_trait<int> { |
| 7 | + const static bool value = true; |
| 8 | +}; |
| 9 | + |
| 10 | +template <class T> |
| 11 | +concept Con1 = type_trait<T>::value; |
| 12 | + |
| 13 | +constexpr int sizeFunc() { return 4; } |
| 14 | + |
| 15 | +template <class T> |
| 16 | +concept ConWithLogicalAnd = Con1<T> && sizeof(T) > sizeFunc(); |
| 17 | + |
| 18 | +namespace ns { |
| 19 | +template <class T> |
| 20 | +concept ConInNamespace = sizeof(T) > 4; |
| 21 | +} |
| 22 | + |
| 23 | +template <class T1, class T2> |
| 24 | +concept ConTwoTemplateParams = ns::ConInNamespace<T1> && ConWithLogicalAnd<T2>; |
| 25 | + |
| 26 | +/* |
| 27 | +OUTPUT: |
| 28 | +{ |
| 29 | + "includes": [], |
| 30 | + "skipped_ranges": [], |
| 31 | + "usr2func": [{ |
| 32 | + "usr": 3226866773869731400, |
| 33 | + "detailed_name": "constexpr int sizeFunc()", |
| 34 | + "qual_name_offset": 14, |
| 35 | + "short_name": "sizeFunc", |
| 36 | + "spell": "13:15-13:23|13:1-13:39|2|-1", |
| 37 | + "bases": [], |
| 38 | + "vars": [], |
| 39 | + "callees": [], |
| 40 | + "kind": 12, |
| 41 | + "parent_kind": 1, |
| 42 | + "storage": 0, |
| 43 | + "declarations": [], |
| 44 | + "derived": [], |
| 45 | + "uses": ["16:52-16:60|36|-1"] |
| 46 | + }], |
| 47 | + "usr2type": [{ |
| 48 | + "usr": 436, |
| 49 | + "detailed_name": "", |
| 50 | + "qual_name_offset": 0, |
| 51 | + "short_name": "", |
| 52 | + "bases": [], |
| 53 | + "funcs": [], |
| 54 | + "types": [], |
| 55 | + "vars": [], |
| 56 | + "alias_of": 0, |
| 57 | + "kind": 0, |
| 58 | + "parent_kind": 0, |
| 59 | + "declarations": [], |
| 60 | + "derived": [], |
| 61 | + "instances": [3643386974125063532, 4683419091429829178], |
| 62 | + "uses": [] |
| 63 | + }, { |
| 64 | + "usr": 452, |
| 65 | + "detailed_name": "", |
| 66 | + "qual_name_offset": 0, |
| 67 | + "short_name": "", |
| 68 | + "bases": [], |
| 69 | + "funcs": [], |
| 70 | + "types": [], |
| 71 | + "vars": [], |
| 72 | + "alias_of": 0, |
| 73 | + "kind": 0, |
| 74 | + "parent_kind": 0, |
| 75 | + "declarations": [], |
| 76 | + "derived": [], |
| 77 | + "instances": [15611304989063975809, 15197037962155352994, 7075924720131397743, 8419381068906673567], |
| 78 | + "uses": [] |
| 79 | + }, { |
| 80 | + "usr": 368613743269466510, |
| 81 | + "detailed_name": "T", |
| 82 | + "qual_name_offset": 0, |
| 83 | + "short_name": "", |
| 84 | + "bases": [], |
| 85 | + "funcs": [], |
| 86 | + "types": [], |
| 87 | + "vars": [], |
| 88 | + "alias_of": 0, |
| 89 | + "kind": 26, |
| 90 | + "parent_kind": 0, |
| 91 | + "declarations": ["19:17-19:18|19:11-19:18|1025|-1"], |
| 92 | + "derived": [], |
| 93 | + "instances": [], |
| 94 | + "uses": ["20:33-20:34|4|-1"] |
| 95 | + }, { |
| 96 | + "usr": 1341599025369786548, |
| 97 | + "detailed_name": "T1", |
| 98 | + "qual_name_offset": 0, |
| 99 | + "short_name": "", |
| 100 | + "bases": [], |
| 101 | + "funcs": [], |
| 102 | + "types": [], |
| 103 | + "vars": [], |
| 104 | + "alias_of": 0, |
| 105 | + "kind": 26, |
| 106 | + "parent_kind": 0, |
| 107 | + "declarations": ["23:17-23:19|23:11-23:19|1|-1"], |
| 108 | + "derived": [], |
| 109 | + "instances": [], |
| 110 | + "uses": ["24:51-24:53|4|-1"] |
| 111 | + }, { |
| 112 | + "usr": 1789177110200181456, |
| 113 | + "detailed_name": "T", |
| 114 | + "qual_name_offset": 0, |
| 115 | + "short_name": "", |
| 116 | + "bases": [], |
| 117 | + "funcs": [], |
| 118 | + "types": [], |
| 119 | + "vars": [], |
| 120 | + "alias_of": 0, |
| 121 | + "kind": 26, |
| 122 | + "parent_kind": 0, |
| 123 | + "declarations": ["15:17-15:18|15:11-15:18|1|-1"], |
| 124 | + "derived": [], |
| 125 | + "instances": [], |
| 126 | + "uses": ["16:34-16:35|4|-1", "16:47-16:48|4|-1"] |
| 127 | + }, { |
| 128 | + "usr": 4001289545226345448, |
| 129 | + "detailed_name": "struct type_trait {}", |
| 130 | + "qual_name_offset": 7, |
| 131 | + "short_name": "type_trait", |
| 132 | + "spell": "2:27-2:37|2:20-4:2|2|-1", |
| 133 | + "bases": [], |
| 134 | + "funcs": [], |
| 135 | + "types": [13813325012676356715], |
| 136 | + "vars": [], |
| 137 | + "alias_of": 0, |
| 138 | + "kind": 23, |
| 139 | + "parent_kind": 1, |
| 140 | + "declarations": [], |
| 141 | + "derived": [10139416838611429657], |
| 142 | + "instances": [], |
| 143 | + "uses": ["11:16-11:26|4|-1"] |
| 144 | + }, { |
| 145 | + "usr": 8987540007709901036, |
| 146 | + "detailed_name": "T", |
| 147 | + "qual_name_offset": 0, |
| 148 | + "short_name": "", |
| 149 | + "bases": [], |
| 150 | + "funcs": [], |
| 151 | + "types": [], |
| 152 | + "vars": [], |
| 153 | + "alias_of": 0, |
| 154 | + "kind": 26, |
| 155 | + "parent_kind": 0, |
| 156 | + "declarations": ["10:17-10:18|10:11-10:18|1|-1"], |
| 157 | + "derived": [], |
| 158 | + "instances": [], |
| 159 | + "uses": ["11:27-11:28|4|-1"] |
| 160 | + }, { |
| 161 | + "usr": 10139416838611429657, |
| 162 | + "detailed_name": "template<> struct type_trait<int> {}", |
| 163 | + "qual_name_offset": 18, |
| 164 | + "short_name": "type_trait", |
| 165 | + "spell": "6:20-6:30|6:1-8:2|2|-1", |
| 166 | + "bases": [4001289545226345448], |
| 167 | + "funcs": [], |
| 168 | + "types": [], |
| 169 | + "vars": [], |
| 170 | + "alias_of": 0, |
| 171 | + "kind": 5, |
| 172 | + "parent_kind": 1, |
| 173 | + "declarations": [], |
| 174 | + "derived": [], |
| 175 | + "instances": [], |
| 176 | + "uses": [] |
| 177 | + }, { |
| 178 | + "usr": 10306412732558468540, |
| 179 | + "detailed_name": "T2", |
| 180 | + "qual_name_offset": 0, |
| 181 | + "short_name": "", |
| 182 | + "bases": [], |
| 183 | + "funcs": [], |
| 184 | + "types": [], |
| 185 | + "vars": [], |
| 186 | + "alias_of": 0, |
| 187 | + "kind": 26, |
| 188 | + "parent_kind": 0, |
| 189 | + "declarations": ["23:27-23:29|23:21-23:29|1|-1"], |
| 190 | + "derived": [], |
| 191 | + "instances": [], |
| 192 | + "uses": ["24:76-24:78|4|-1"] |
| 193 | + }, { |
| 194 | + "usr": 11072669167287398027, |
| 195 | + "detailed_name": "namespace ns {}", |
| 196 | + "qual_name_offset": 10, |
| 197 | + "short_name": "ns", |
| 198 | + "bases": [], |
| 199 | + "funcs": [], |
| 200 | + "types": [368613743269466510], |
| 201 | + "vars": [{ |
| 202 | + "L": 7075924720131397743, |
| 203 | + "R": -1 |
| 204 | + }], |
| 205 | + "alias_of": 0, |
| 206 | + "kind": 3, |
| 207 | + "parent_kind": 0, |
| 208 | + "declarations": ["18:11-18:13|18:1-21:2|1|-1"], |
| 209 | + "derived": [], |
| 210 | + "instances": [], |
| 211 | + "uses": ["24:32-24:34|4|-1"] |
| 212 | + }, { |
| 213 | + "usr": 13813325012676356715, |
| 214 | + "detailed_name": "T", |
| 215 | + "qual_name_offset": 0, |
| 216 | + "short_name": "", |
| 217 | + "bases": [], |
| 218 | + "funcs": [], |
| 219 | + "types": [], |
| 220 | + "vars": [], |
| 221 | + "alias_of": 0, |
| 222 | + "kind": 26, |
| 223 | + "parent_kind": 0, |
| 224 | + "declarations": ["2:17-2:18|2:11-2:18|1025|-1"], |
| 225 | + "derived": [], |
| 226 | + "instances": [], |
| 227 | + "uses": [] |
| 228 | + }], |
| 229 | + "usr2var": [{ |
| 230 | + "usr": 3643386974125063532, |
| 231 | + "detailed_name": "static const bool type_trait::value", |
| 232 | + "qual_name_offset": 18, |
| 233 | + "short_name": "value", |
| 234 | + "hover": "static const bool type_trait::value = false", |
| 235 | + "type": 436, |
| 236 | + "kind": 8, |
| 237 | + "parent_kind": 23, |
| 238 | + "storage": 2, |
| 239 | + "declarations": ["3:21-3:26|3:3-3:34|1025|-1"], |
| 240 | + "uses": ["11:31-11:36|4|-1"] |
| 241 | + }, { |
| 242 | + "usr": 4683419091429829178, |
| 243 | + "detailed_name": "static const bool type_trait<int>::value", |
| 244 | + "qual_name_offset": 18, |
| 245 | + "short_name": "value", |
| 246 | + "hover": "static const bool type_trait<int>::value = true", |
| 247 | + "type": 436, |
| 248 | + "kind": 8, |
| 249 | + "parent_kind": 5, |
| 250 | + "storage": 2, |
| 251 | + "declarations": ["7:21-7:26|7:3-7:33|1025|-1"], |
| 252 | + "uses": [] |
| 253 | + }, { |
| 254 | + "usr": 7075924720131397743, |
| 255 | + "detailed_name": "int ns::ConInNamespace", |
| 256 | + "qual_name_offset": 4, |
| 257 | + "short_name": "ConInNamespace", |
| 258 | + "hover": "int ns::ConInNamespace = sizeof(T) > 4", |
| 259 | + "spell": "20:9-20:23|20:1-20:39|1026|-1", |
| 260 | + "type": 452, |
| 261 | + "kind": 13, |
| 262 | + "parent_kind": 3, |
| 263 | + "storage": 0, |
| 264 | + "declarations": [], |
| 265 | + "uses": ["24:36-24:50|4|-1"] |
| 266 | + }, { |
| 267 | + "usr": 8419381068906673567, |
| 268 | + "detailed_name": "int ConTwoTemplateParams", |
| 269 | + "qual_name_offset": 4, |
| 270 | + "short_name": "ConTwoTemplateParams", |
| 271 | + "hover": "int ConTwoTemplateParams = ns::ConInNamespace<T1> && ConWithLogicalAnd<T2>", |
| 272 | + "spell": "24:9-24:29|24:1-24:79|2|-1", |
| 273 | + "type": 452, |
| 274 | + "kind": 13, |
| 275 | + "parent_kind": 1, |
| 276 | + "storage": 0, |
| 277 | + "declarations": [], |
| 278 | + "uses": [] |
| 279 | + }, { |
| 280 | + "usr": 15197037962155352994, |
| 281 | + "detailed_name": "int ConWithLogicalAnd", |
| 282 | + "qual_name_offset": 4, |
| 283 | + "short_name": "ConWithLogicalAnd", |
| 284 | + "hover": "int ConWithLogicalAnd = Con1<T> && sizeof(T) > sizeFunc()", |
| 285 | + "spell": "16:9-16:26|16:1-16:62|2|-1", |
| 286 | + "type": 452, |
| 287 | + "kind": 13, |
| 288 | + "parent_kind": 1, |
| 289 | + "storage": 0, |
| 290 | + "declarations": [], |
| 291 | + "uses": ["24:58-24:75|4|-1"] |
| 292 | + }, { |
| 293 | + "usr": 15611304989063975809, |
| 294 | + "detailed_name": "int Con1", |
| 295 | + "qual_name_offset": 4, |
| 296 | + "short_name": "Con1", |
| 297 | + "hover": "int Con1 = type_trait<T>::value", |
| 298 | + "spell": "11:9-11:13|11:1-11:36|2|-1", |
| 299 | + "type": 452, |
| 300 | + "kind": 13, |
| 301 | + "parent_kind": 1, |
| 302 | + "storage": 0, |
| 303 | + "declarations": [], |
| 304 | + "uses": ["16:29-16:33|4|-1"] |
| 305 | + }] |
| 306 | +} |
| 307 | +*/ |
0 commit comments