fail_base_no_extend.carbon 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 [template] {
  27. // CHECK:STDOUT: .Core = %Core
  28. // CHECK:STDOUT: .B = %B.decl
  29. // CHECK:STDOUT: .C = %C.decl
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  32. // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {}
  33. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT:
  36. // CHECK:STDOUT: class @B {
  37. // CHECK:STDOUT: !members:
  38. // CHECK:STDOUT: .Self = constants.%B
  39. // CHECK:STDOUT: }
  40. // CHECK:STDOUT:
  41. // CHECK:STDOUT: class @C {
  42. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
  43. // CHECK:STDOUT: %.loc13: <unbound element of class C> = base_decl B, element0 [template]
  44. // CHECK:STDOUT:
  45. // CHECK:STDOUT: !members:
  46. // CHECK:STDOUT: .Self = constants.%C
  47. // CHECK:STDOUT: .base = %.loc13
  48. // CHECK:STDOUT: }
  49. // CHECK:STDOUT: