fail_base_no_extend.carbon 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. base class B {}
  7. class C {
  8. // CHECK:STDERR: fail_base_no_extend.carbon:[[@LINE+3]]:3: ERROR: Missing `extend` before `base` declaration in class.
  9. // CHECK:STDERR: base: B;
  10. // CHECK:STDERR: ^~~~~~~~
  11. base: B;
  12. }
  13. // CHECK:STDOUT: --- fail_base_no_extend.carbon
  14. // CHECK:STDOUT:
  15. // CHECK:STDOUT: constants {
  16. // CHECK:STDOUT: %B: type = class_type @B [template]
  17. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  18. // CHECK:STDOUT: %C: type = class_type @C [template]
  19. // CHECK:STDOUT: %.2: type = tuple_type () [template]
  20. // CHECK:STDOUT: %.3: type = ptr_type {} [template]
  21. // CHECK:STDOUT: %.4: type = unbound_element_type C, B [template]
  22. // CHECK:STDOUT: %.5: type = struct_type {.base: B} [template]
  23. // CHECK:STDOUT: }
  24. // CHECK:STDOUT:
  25. // CHECK:STDOUT: file {
  26. // CHECK:STDOUT: package: <namespace> = namespace {
  27. // CHECK:STDOUT: .B = %B.decl
  28. // CHECK:STDOUT: .C = %C.decl
  29. // CHECK:STDOUT: } [template]
  30. // CHECK:STDOUT: %B.decl = class_decl @B {} [template = constants.%B]
  31. // CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C]
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT:
  34. // CHECK:STDOUT: class @B {
  35. // CHECK:STDOUT:
  36. // CHECK:STDOUT: !members:
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: class @C {
  40. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
  41. // CHECK:STDOUT: %.loc13: <unbound element of class C> = base_decl B, element0 [template]
  42. // CHECK:STDOUT:
  43. // CHECK:STDOUT: !members:
  44. // CHECK:STDOUT: .base = %.loc13
  45. // CHECK:STDOUT: }
  46. // CHECK:STDOUT: