Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Issue 2434253003: Make base::Optional constructor constexpr. (Closed)

Created:
4 years, 2 months ago by alshabalin
Modified:
4 years, 1 month ago
CC:
chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make base::Optional constructor constexpr. BUG= Committed: https://crrev.com/9494e454fa120c3d77f87c66142ef35f85ff225b Cr-Commit-Position: refs/heads/master@{#427311}

Patch Set 1 #

Total comments: 2

Patch Set 2 : Make nullopt constructor constexpr. #

Patch Set 3 : Make value constructors constexpr. #

Total comments: 6

Patch Set 4 : Address review comments. #

Patch Set 5 : Remove constexpr from move and forward ctors #

Patch Set 6 : Remove delegating ctor from nullopt ctor #

Unified diffs Side-by-side diffs Delta from patch set Stats (+65 lines, -37 lines) Patch
M base/optional.h View 1 2 3 4 5 4 chunks +36 lines, -8 lines 0 comments Download
M base/optional_unittest.cc View 1 2 3 4 4 chunks +29 lines, -29 lines 0 comments Download

Messages

Total messages: 37 (16 generated)
alshabalin
PTAL
4 years, 2 months ago (2016-10-21 09:16:16 UTC) #3
danakj
https://codereview.chromium.org/2434253003/diff/1/base/optional_unittest.cc File base/optional_unittest.cc (right): https://codereview.chromium.org/2434253003/diff/1/base/optional_unittest.cc#newcode99 base/optional_unittest.cc:99: static_assert(!base::Optional<bool>(), "OptionalHasConstexprConstructor"); Can you add tests for the other ...
4 years, 2 months ago (2016-10-21 21:05:02 UTC) #4
alshabalin
https://codereview.chromium.org/2434253003/diff/1/base/optional_unittest.cc File base/optional_unittest.cc (right): https://codereview.chromium.org/2434253003/diff/1/base/optional_unittest.cc#newcode99 base/optional_unittest.cc:99: static_assert(!base::Optional<bool>(), "OptionalHasConstexprConstructor"); On 2016/10/21 21:05:01, danakj wrote: > Can ...
4 years, 2 months ago (2016-10-21 22:36:05 UTC) #5
danakj
LGTM w nits https://codereview.chromium.org/2434253003/diff/40001/base/optional.h File base/optional.h (right): https://codereview.chromium.org/2434253003/diff/40001/base/optional.h#newcode45 base/optional.h:45: // When T is not trivially ...
4 years, 2 months ago (2016-10-21 23:12:08 UTC) #6
alshabalin
https://codereview.chromium.org/2434253003/diff/40001/base/optional.h File base/optional.h (right): https://codereview.chromium.org/2434253003/diff/40001/base/optional.h#newcode45 base/optional.h:45: // When T is not trivially destructible we must ...
4 years, 2 months ago (2016-10-22 07:47:52 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2434253003/60001
4 years, 2 months ago (2016-10-22 07:48:16 UTC) #10
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_compile_dbg_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_compile_dbg_ng/builds/282004)
4 years, 2 months ago (2016-10-22 08:12:51 UTC) #12
alshabalin
On 2016/10/21 21:05:02, danakj wrote: > https://codereview.chromium.org/2434253003/diff/1/base/optional_unittest.cc > File base/optional_unittest.cc (right): > > https://codereview.chromium.org/2434253003/diff/1/base/optional_unittest.cc#newcode99 > ...
4 years, 2 months ago (2016-10-22 22:16:26 UTC) #15
alshabalin
On 2016/10/22 22:16:26, alshabalin wrote: > On 2016/10/21 21:05:02, danakj wrote: > > https://codereview.chromium.org/2434253003/diff/1/base/optional_unittest.cc > ...
4 years, 2 months ago (2016-10-22 22:47:38 UTC) #16
alshabalin
Everything seems to work now. Could you please take another look?
4 years, 2 months ago (2016-10-23 08:27:49 UTC) #21
danakj
LGTM thanks for the todos and investigations
4 years, 1 month ago (2016-10-25 00:09:14 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2434253003/100001
4 years, 1 month ago (2016-10-25 00:09:52 UTC) #24
commit-bot: I haz the power
Try jobs failed on following builders: ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/builds/93472)
4 years, 1 month ago (2016-10-25 00:23:02 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2434253003/100001
4 years, 1 month ago (2016-10-25 06:04:57 UTC) #28
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 1 month ago (2016-10-25 09:57:06 UTC) #30
commit-bot: I haz the power
Patchset 6 (id:??) landed as https://crrev.com/9494e454fa120c3d77f87c66142ef35f85ff225b Cr-Commit-Position: refs/heads/master@{#427311}
4 years, 1 month ago (2016-10-25 09:58:26 UTC) #32
Mostyn Bramley-Moore
This seems to have broken GCC (tested with 4.8) builds: FAILED: obj/services/ui/public/interfaces/interfaces_cpp_sources/ime.mojom.o ccache g++ -MMD ...
4 years, 1 month ago (2016-10-25 13:01:11 UTC) #33
danakj
On 2016/10/25 13:01:11, Mostyn Bramley-Moore wrote: > This seems to have broken GCC (tested with ...
4 years, 1 month ago (2016-10-25 20:18:09 UTC) #34
Mostyn Bramley-Moore
On 2016/10/25 20:18:09, danakj wrote: > On 2016/10/25 13:01:11, Mostyn Bramley-Moore wrote: > > This ...
4 years, 1 month ago (2016-10-25 22:13:25 UTC) #35
alshabalin
On 2016/10/25 22:13:25, Mostyn Bramley-Moore wrote: > On 2016/10/25 20:18:09, danakj wrote: > > On ...
4 years, 1 month ago (2016-10-26 11:32:38 UTC) #36
alshabalin
4 years, 1 month ago (2016-10-26 11:47:50 UTC) #37
Message was sent while issue was closed.
On 2016/10/25 13:01:11, Mostyn Bramley-Moore wrote:
> This seems to have broken GCC (tested with 4.8) builds:
> 
> FAILED: obj/services/ui/public/interfaces/interfaces_cpp_sources/ime.mojom.o 
> ccache g++ -MMD -MF
> obj/services/ui/public/interfaces/interfaces_cpp_sources/ime.mojom.o.d
> -DV8_DEPRECATION_WARNINGS -DENABLE_MDNS=1 -DENABLE_NOTIFICATIONS
> -DENABLE_PLUGINS=1 -DENABLE_PDF=1 -DENABLE_SPELLCHECK=1
> -DUI_COMPOSITOR_IMAGE_TRANSPORT -DUSE_AURA=1 -DUSE_DEFAULT_RENDER_THEME=1
> -DUSE_NSS_CERTS=1 -DUSE_OZONE=1 -DDISABLE_NACL -DENABLE_EXTENSIONS=1
> -DENABLE_TASK_MANAGER=1 -DENABLE_THEMES=1 -DENABLE_SESSION_SERVICE=1
> -DENABLE_SUPERVISED_USERS=1 -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD
> -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -DENABLE_MEDIA_ROUTER=1
> -DFIELDTRIAL_TESTING_ENABLED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
> -D_LARGEFILE64_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
> -D_FORTIFY_SOURCE=2 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0
> -DGL_GLEXT_PROTOTYPES -DUSE_GLX -DUSE_EGL -DSK_IGNORE_DW_GRAY_FIX
> -DSK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS -DSK_SUPPORT_GPU=1
> -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DU_NOEXCEPT=
> -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -I../..
-Igen
> -I../../third_party/khronos -I../../gpu -I../../skia/config -I../../skia/ext
> -I../../third_party/skia/include/c -I../../third_party/skia/include/config
> -I../../third_party/skia/include/core -I../../third_party/skia/include/effects
> -I../../third_party/skia/include/images -I../../third_party/skia/include/lazy
> -I../../third_party/skia/include/pathops -I../../third_party/skia/include/pdf
> -I../../third_party/skia/include/pipe -I../../third_party/skia/include/ports
> -I../../third_party/skia/include/utils -I../../third_party/skia/include/gpu
> -I../../third_party/skia/src/gpu -I../../third_party/skia/src/sksl
> -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n
> -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector
-funwind-tables
> -fPIC -pipe -pthread -m64 -march=x86-64 -Wall -Werror
-Wno-unused-local-typedefs
> -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-unused-parameter
> -O2 -fno-ident -fdata-sections -ffunction-sections -g0 -fvisibility=hidden
> -fno-threadsafe-statics -fvisibility-inlines-hidden -std=gnu++11
-Wno-narrowing
> -fno-rtti -fno-exceptions -c gen/services/ui/public/interfaces/ime.mojom.cc -o
> obj/services/ui/public/interfaces/interfaces_cpp_sources/ime.mojom.o
> In file included from gen/services/ui/public/interfaces/ime.mojom.h:10:0,
>                  from gen/services/ui/public/interfaces/ime.mojom.cc:15:
> /usr/include/c++/4.8/type_traits: In instantiation of 'struct
> std::is_convertible<std::default_delete<ui::Event>,
> std::default_delete<ui::Event> >':
> /usr/include/c++/4.8/type_traits:116:12:   required from 'struct
> std::__and_<std::__not_<std::is_array<ui::Event> >,
> std::is_convertible<std::default_delete<ui::Event>,
> std::default_delete<ui::Event> > >'
> /usr/include/c++/4.8/type_traits:121:12:   required from 'struct
> std::__and_<std::is_convertible<ui::Event*, ui::Event*>,
> std::__not_<std::is_array<ui::Event> >,
> std::is_convertible<std::default_delete<ui::Event>,
> std::default_delete<ui::Event> > >'
> /usr/include/c++/4.8/type_traits:1775:71:   required by substitution of
> 'template<class ... _Cond> using _Require = typename
std::enable_if<std::__and_<
> <template-parameter-1-1> >::value>::type [with _Cond =
> {std::is_convertible<ui::Event*, ui::Event*>,
> std::__not_<std::is_array<ui::Event> >, std::conditional<false,
> std::is_same<std::default_delete<ui::Event>, std::default_delete<ui::Event> >,
> std::is_convertible<std::default_delete<ui::Event>,
> std::default_delete<ui::Event> > >::type}]'
> /usr/include/c++/4.8/bits/unique_ptr.h:163:44:   required from 'constexpr
> base::internal::OptionalStorage<T, <anonymous> >::OptionalStorage() [with T =
> std::unique_ptr<ui::Event>; bool <anonymous> = false]'
> ../../base/optional.h:119:13:   required from here
> /usr/include/c++/4.8/type_traits:1317:12: error: the value of
> 'std::__is_convertible_helper<std::default_delete<ui::Event>,
> std::default_delete<ui::Event>, false>::value' is not usable in a constant
> expression
> /usr/include/c++/4.8/type_traits:1312:29: note:
> 'std::__is_convertible_helper<std::default_delete<ui::Event>,
> std::default_delete<ui::Event>, false>::value' used in its own initializer
> /usr/include/c++/4.8/type_traits:1317:12: note: in template argument for type
> 'bool' 
> gen/services/ui/public/interfaces/ime.mojom.cc: In constructor
> 'ui::mojom::CompositionEvent::CompositionEvent()':
> gen/services/ui/public/interfaces/ime.mojom.cc:75:17: note: synthesized method
> 'constexpr base::Optional<T>::Optional() [with T =
std::unique_ptr<ui::Event>]'
> first required here

I've made a follow up CL fixing this:
https://codereview.chromium.org/2453733002/

Powered by Google App Engine
This is Rietveld 408576698