New issue
Advanced search Search tips

Issue 905990 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Nov 20
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

no delclaration matches '{anonymous}::GetInstanceIfExists()'

Reported by wangqing...@loongson.cn, Nov 16

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3189.0 Safari/537.36

Steps to reproduce the problem:
1. pull lastest chromium code
2. build chrome release

What is the expected behavior?

What went wrong?
[75/32715] CXX obj/base/base/memory_dump_manager.o
FAILED: obj/base/base/memory_dump_manager.o
mips64el-redhat-linux-g++ -MMD -MF obj/base/base/memory_dump_manager.o.d -DUSE_SYMBOLIZE -DV8_DEPRECATION_WARNINGS -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_X11=1 -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_MIPS_ARCH_LOONGSON -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS -DCR_LIBCXX_REVISION=344254 -DCR_LIBCXXABI_REVISION=344215 -D_LIBCPP_ENABLE_NODISCARD -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DBASE_IMPLEMENTATION -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32 -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26 -I../.. -Igen -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -funwind-tables -fPIC -pipe -pthread -D__SANE_USERSPACE_TYPES__ -EL -mabi=64 -march=loongson3a -mno-branch-likely -Wa,-march=loongson3a -Wall -Wno-unused-local-typedefs -Wno-maybe-uninitialized -Wno-deprecated-declarations -Wno-comments -Wno-missing-field-initializers -Wno-unused-parameter -fno-omit-frame-pointer -g0 -fno-builtin-abs -fvisibility=hidden -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -O2 -fno-ident -fdata-sections -ffunction-sections -std=gnu++14 -Wno-narrowing -fno-exceptions -fno-rtti -nostdinc++ -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include -fvisibility-inlines-hidden -c ../../base/trace_event/memory_dump_manager.cc -o obj/base/base/memory_dump_manager.o
In file included from ../../base/trace_event/memory_dump_manager.h:19,
                 from ../../base/trace_event/memory_dump_manager.cc:5:
../../base/memory/singleton.h: In instantiation of ‘class base::Singleton<base::trace_event::MemoryDumpManager, base::LeakySingletonTraits<base::trace_event::MemoryDumpManager> >’:
../../base/trace_event/memory_dump_manager.cc:90:60:   required from here
../../base/memory/singleton.h:227:16: error:no declaration matches ‘base::trace_event::MemoryDumpManager* base::trace_event::MemoryDumpManager::GetInstanceIfExists()’
   friend Type* Type::GetInstanceIfExists();
                ^~~~
../../base/memory/singleton.h:227:16: note:no functions named ‘base::trace_event::MemoryDumpManager* base::trace_event::MemoryDumpManager::GetInstanceIfExists()’
In file included from ../../base/trace_event/memory_dump_manager.cc:5:
../../base/trace_event/memory_dump_manager.h:40:19: note:‘class base::trace_event::MemoryDumpManager’ defined here
 class BASE_EXPORT MemoryDumpManager {
                   ^~~~~~~~~~~~~~~~~
[80/32715] CXX obj/base/base/trace_log.o
In file included from ../../base/bind.h:10,
                 from ../../base/trace_event/trace_log.cc:13:
../../base/bind_internal.h: in function ‘bool base::internal::QueryCancellationTraitsImpl(base::internal::BindStateBase::CancellationQueryMode, const Functor&, const BoundArgsTuple&, std::__1::index_sequence<indices ...>) [with Functor = void (base::trace_event::TraceLog::AsyncEnabledStateObserver::*)(); BoundArgsTuple = std::__1::tuple<base::WeakPtr<base::trace_event::TraceLog::AsyncEnabledStateObserver> >; long unsigned int ...indices = {0}]’:
 }

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 62.0.3189.0  Channel: n/a
OS Version: OS X 10.14.0
Flash Version:
 
Cc: gab@chromium.org
Components: Speed>Tracing
gab@ you added this declaration. Any thoughts on this error report?
Looks like g++, unlike clang, is unhappy about friending a function that does not exist. Since clang was happy with this I figured it was okay to friend a method which Singleton impls weren't forced to implement.

What does the C++ spec say w.r.t friending a method? Does it have to exist?
Owner: gab@chromium.org
Status: Assigned (was: Unconfirmed)
It doesn't look like you can do that; http://eel.is/c++draft/class.friend#9 :

"A name nominated by a friend declaration shall be accessible in the scope of the class containing the friend declaration."

You can make a class a friend with a previous forward declaration, but if you friend a method you have to have it accessible.

Project Member

Comment 4 by bugdroid1@chromium.org, Nov 20

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0fc5f9d3864137ca0063ab9665f59644f93427fa

commit 0fc5f9d3864137ca0063ab9665f59644f93427fa
Author: Gabriel Charette <gab@chromium.org>
Date: Tue Nov 20 21:26:37 2018

[base] Broaden Singleton's friend declarations

Friend'ing specific methods is incorrect since the addition of
GetIfExits() because, although clang compiles this without warnings,
the spec clearly says that friend'ing an undeclared method is not
allowed (even if no such method ever exists and hence never uses that
friend declaration). Not nearly all singletons need to support
GetInstanceIfExists() and hence adding everywhere is undesired.

This CL makes Singleton<T> friend all of T. This is fine because
that doesn't give much more power to T (beyond the option of naming
its GetInstance() method differently...).

Bug:  905990 
Change-Id: I2d2c721b27f8f3fa3367dff996f37293c98674c3
Reviewed-on: https://chromium-review.googlesource.com/c/1343660
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609809}
[modify] https://crrev.com/0fc5f9d3864137ca0063ab9665f59644f93427fa/base/memory/singleton.h

Status: Fixed (was: Assigned)
Fixed I think, please verify on gcc

Sign in to add a comment