Skip to content

deps/v8/src/objects.h:3263:46: error: invalid use of incomplete type ‘class v8::internal::Heap #10388

Description

@octoploid
  • Version:
  • Platform:
  • Subsystem:

Compilation fails with gcc-7:

 % g++ '-DV8_TARGET_ARCH_X64' '-DENABLE_DISASSEMBLER' '-DV8_I18N_SUPPORT' -I../deps/v8 -I../. -pthread -Wall -Wextra -Wno-unused-parameter -m64 -fno-strict-aliasing -m64 -fdata-sections -ffunction-sections -O3 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF /home/markus/tmp/node/out/Release/.deps//home/markus/tmp/node/out/Release/obj.target/v8_nosnapshot/gen/libraries.o.d.raw -c -o /home/markus/tmp/node/out/Release/obj.target/v8_nosnapshot/gen/libraries.o /home/markus/tmp/node/out/Release/obj/gen/libraries.cc

In file included from ../deps/v8/src/snapshot/natives.h:8:0,
                 from /home/markus/tmp/node/out/Release/obj/gen/libraries.cc:8:
../deps/v8/src/objects.h: In member function ‘uint32_t v8::internal::HashTable<Derived, Shape, Key>::Hash(Key)’:
../deps/v8/src/objects.h:3263:46: error: invalid use of incomplete type ‘class v8::internal::Heap’
       return Shape::SeededHash(key, GetHeap()->HashSeed());
                                              ^~
In file included from ../deps/v8/src/v8.h:8:0,
                 from /home/markus/tmp/node/out/Release/obj/gen/libraries.cc:7:
../deps/v8/include/v8.h:149:7: note: forward declaration of ‘class v8::internal::Heap’
 class Heap;
       ^~~~
In file included from ../deps/v8/src/snapshot/natives.h:8:0,
                 from /home/markus/tmp/node/out/Release/obj/gen/libraries.cc:8:
../deps/v8/src/objects.h: In member function ‘uint32_t v8::internal::HashTable<Derived, Shape, Key>::HashForObject(Key, v8::internal::Object*)’:
../deps/v8/src/objects.h:3271:55: error: invalid use of incomplete type ‘class v8::internal::Heap’
       return Shape::SeededHashForObject(key, GetHeap()->HashSeed(), object);
                                                       ^~
In file included from ../deps/v8/src/v8.h:8:0,
                 from /home/markus/tmp/node/out/Release/obj/gen/libraries.cc:7:
../deps/v8/include/v8.h:149:7: note: forward declaration of ‘class v8::internal::Heap’
 class Heap;
       ^~~~

The code is ill formed (no diagnostic required) according the C++ standard.

Activity

added
v8 engineIssues and PRs related to the V8 dependency.
on Dec 21, 2016

targos commented on Dec 21, 2016

@targos
Member

cc @nodejs/v8

mscdex commented on Dec 21, 2016

@mscdex
Contributor

@octoploid What node version?

octoploid commented on Dec 21, 2016

@octoploid
Author

Latest git branch master.

gibfahn commented on Dec 22, 2016

@gibfahn
Member

@octoploid what platform are you on?

jeisinger commented on Dec 22, 2016

@jeisinger
Contributor

octoploid commented on Dec 22, 2016

@octoploid
Author

I'm running Linux. Let me quote the C++ std:

14.6/8: "If a hypothetical instantiation of a template immediately following its definition would be ill-formed due to a construct that does not depend on a template parameter, the program is ill-formed; no diagnostic is required. If the interpretation of such a construct in the hypothetical instantiation is different from the interpretation of the corresponding construct in any actual instantiation of the template, the program is ill-formed; no diagnostic is required.
[ Note: This can happen in situations including the following: * a type used in a non-dependent name is incomplete at the point at which a template is defined but is complete at the point at which an instantiation is performed, ....

octoploid commented on Dec 22, 2016

@octoploid
Author
 % cat tc.ii
class Heap;
class A {
public:
  Heap *m_fn1();
};
template <typename> class B : A {
  void m_fn2() { m_fn1()->HashSeed; }
};
 
% g++ -c tc.ii
tc.ii: In member function ‘void B< <template-parameter-1-1> >::m_fn2()’:
tc.ii:7:25: error: invalid use of incomplete type ‘class Heap’
   void m_fn2() { m_fn1()->HashSeed; }
                         ^~
tc.ii:1:7: note: forward declaration of ‘class Heap’
 class Heap;
       ^~~~

hashseed commented on Dec 22, 2016

@hashseed
Member

it should work by including heap.h into natives.h?

added
buildIssues and PRs related to Node.js builds or CI infrastructure.
on Feb 2, 2017

sgallagher commented on Feb 15, 2017

@sgallagher
Contributor

For the record, just including heap.h (or heap.h plus heap-inl.h) into natives.h does not result in a successful build.

Example: https://kojipkgs.fedoraproject.org//work/tasks/8811/17888811/build.log (note: this is a transient build and will be reaped in seven days)

kasicka commented on Feb 22, 2017

@kasicka

hashseed commented on Feb 23, 2017

@hashseed
Member

Some small refactoring to move the code out of objects.h into objects-inl.h should hopefully fix this issue. I'll come up with a patch tomorrow.

bnoordhuis commented on Feb 28, 2017

@bnoordhuis
Member

g++ 6.3.1 works okay and I'm not adventurous enough to upgrade my FC25 box to Rawhide. Any suggestions?

sgallagher commented on Feb 28, 2017

@sgallagher
Contributor

g++ 6.3.1 works okay and I'm not adventurous enough to upgrade my FC25 box to Rawhide. Any suggestions?

On Fedora 25, you can do:
dnf install mock
Add your user to the mock group in /etc/group and log out and back in (so it takes effect).

Then you can do:

$ mock -r fedora-rawhide-x86_64 init
$ mock -r fedora-rawhide-x86_64 install <packages needed for building>
$ mock -r fedora-rawhide-x86_64 --copyin <src> <dest>
$ mock -r fedora-rawhide-x86_64 shell

Inside that chroot, you essentially have Fedora 26/Rawhide (running on the F25 kernel).

52 remaining items

added a commit that references this issue on Jul 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildIssues and PRs related to Node.js builds or CI infrastructure.v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions