Ошибка компилятора на классе без свойств

Open
#837 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp, php
Domain
compilers

Research direction

Reproduce the case described in the issue: an anonymous callback inside class A calls an A method, while A contains an instance of empty class B. Compare compilation with and without a property in B, then trace the compiler path producing static_assert(!std::is_empty{}); done means the valid empty-class case compiles without the assertion.

Written by the indexing model from the issue text.

Description

Внутри класса A регистрирую коллбек в виде анонимной функции, в нём выполняется метод класса A. Одним из свойств класса A является экземпляр класса B, в классе B нет свойств. При компиляции выскакивает ошибка:

static_assert(!std::is_empty{}, "class T may not be empty")

Если добавить в класс B произвольное свойство, ошибка компиляции исчезает.

Dominant language
C++
Stars
1.5k
Forks
116
Avg merge
5d 17h
Merged PRs (30d)
11

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from VKCOM/kphp

All issues in VKCOM/kphp

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.