Bug 171010 - Vector.h: error: 'auto' not allowed in lambda parameter
Summary: Vector.h: error: 'auto' not allowed in lambda parameter
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on: 170102 170994
Blocks:
  Show dependency treegraph
 
Reported: 2017-04-19 14:32 PDT by David Kilzer (:ddkilzer)
Modified: 2017-04-23 22:58 PDT (History)
12 users (show)

See Also:


Attachments
Patch (1.48 KB, patch)
2017-04-19 14:38 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2017-04-19 14:32:26 PDT
In file included from $(INSTALL_ROOT)/System/Library/Frameworks/WebKit.framework/PrivateHeaders/EnvironmentUtilities.h:29:
In file included from $(SDKROOT)/usr/local/include/wtf/text/WTFString.h:30:
In file included from $(SDKROOT)/usr/local/include/wtf/text/StringImpl.h:35:
$(SDKROOT)/usr/local/include/wtf/Vector.h:1526:47: error: 'auto' not allowed in lambda parameter
    return removeRepeatedElements(vector, [] (auto& a, auto& b) { return a == b; });
                                              ^~~~
$(SDKROOT)/usr/local/include/wtf/Vector.h:1526:56: error: 'auto' not allowed in lambda parameter
    return removeRepeatedElements(vector, [] (auto& a, auto& b) { return a == b; });
                                                       ^~~~
2 errors generated.

This code was committed in Bug 170102, but was triggered by a change in Bug 170994 that exposed EnvironmentUtilities.h as a private header in WebKit.framework.
Comment 1 David Kilzer (:ddkilzer) 2017-04-19 14:32:35 PDT
<rdar://problem/31716076>
Comment 2 David Kilzer (:ddkilzer) 2017-04-19 14:38:50 PDT
Created attachment 307509 [details]
Patch
Comment 3 Build Bot 2017-04-19 14:39:55 PDT
Attachment 307509 [details] did not pass style-queue:


ERROR: Source/WTF/wtf/Vector.h:1526:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Saam Barati 2017-04-19 14:45:10 PDT
Comment on attachment 307509 [details]
Patch

r=me
Comment 5 WebKit Commit Bot 2017-04-19 16:21:23 PDT
Comment on attachment 307509 [details]
Patch

Clearing flags on attachment: 307509

Committed r215538: <http://trac.webkit.org/changeset/215538>
Comment 6 WebKit Commit Bot 2017-04-19 16:21:25 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Chris Dumez 2017-04-19 16:33:49 PDT
Comment on attachment 307509 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=307509&action=review

> Source/WTF/ChangeLog:3
> +        Vector.h: error: 'auto' not allowed in lambda parameter

It is allowed with c++14. The issue is that the project in question is building with c++11 support instead of c++14. I think we should fix this instead.
Comment 8 Chris Dumez 2017-04-19 16:36:14 PDT
Comment on attachment 307509 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=307509&action=review

>> Source/WTF/ChangeLog:3
>> +        Vector.h: error: 'auto' not allowed in lambda parameter
> 
> It is allowed with c++14. The issue is that the project in question is building with c++11 support instead of c++14. I think we should fix this instead.

Source/WebKit/mac/Configurations/WebKitLegacy.xcconfig:OTHER_TAPI_FLAGS[sdk=iphone*] = -x objective-c++ -std=c++11 -fno-rtti;

We likely want c++14 here.
Comment 9 Brent Fulgham 2017-04-19 16:44:30 PDT
Comment on attachment 307509 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=307509&action=review

>>> Source/WTF/ChangeLog:3
>>> +        Vector.h: error: 'auto' not allowed in lambda parameter
>> 
>> It is allowed with c++14. The issue is that the project in question is building with c++11 support instead of c++14. I think we should fix this instead.
> 
> Source/WebKit/mac/Configurations/WebKitLegacy.xcconfig:OTHER_TAPI_FLAGS[sdk=iphone*] = -x objective-c++ -std=c++11 -fno-rtti;
> 
> We likely want c++14 here.

I think this also broke the Windows build, so we may want to be careful.
Comment 10 Chris Dumez 2017-04-20 12:32:41 PDT
Can we roll this out after https://trac.webkit.org/changeset/215560/webkit ?
Comment 11 Brent Fulgham 2017-04-20 12:37:40 PDT
(In reply to Chris Dumez from comment #10)
> Can we roll this out after https://trac.webkit.org/changeset/215560/webkit ?

It also breaks Windows, so I don't think so.
Comment 12 Brent Fulgham 2017-04-21 09:23:49 PDT
(In reply to Chris Dumez from comment #10)
> Can we roll this out after https://trac.webkit.org/changeset/215560/webkit ?

I think we can roll this workaround out once we update our Windows build infrastructure to Visual Studio 2017.
Comment 13 Brent Fulgham 2017-04-21 10:30:57 PDT
(In reply to Brent Fulgham from comment #12)
> (In reply to Chris Dumez from comment #10)
> > Can we roll this out after https://trac.webkit.org/changeset/215560/webkit ?
> 
> I think we can roll this workaround out once we update our Windows build
> infrastructure to Visual Studio 2017.

I'm wrong!

I just rolled this patch out locally, and was able to build WebKit without trouble on Windows. So it looks like VS2015 Update 3's C++14 support is sufficient here.
Comment 14 David Kilzer (:ddkilzer) 2017-04-23 15:58:53 PDT
(In reply to Brent Fulgham from comment #13)
> (In reply to Brent Fulgham from comment #12)
> > (In reply to Chris Dumez from comment #10)
> > > Can we roll this out after https://trac.webkit.org/changeset/215560/webkit ?
> > 
> > I think we can roll this workaround out once we update our Windows build
> > infrastructure to Visual Studio 2017.
> 
> I'm wrong!
> 
> I just rolled this patch out locally, and was able to build WebKit without
> trouble on Windows. So it looks like VS2015 Update 3's C++14 support is
> sufficient here.

Based on Source/WebKit2/Configurations/Base.xcconfig, we can't roll out this change until we switch to c++14 (or gnu++14) for this:

OTHER_TAPI_FLAGS[sdk=iphone*] = -x objective-c++ -std=c++11 -fno-rtti;
Comment 15 Alexey Proskuryakov 2017-04-23 22:58:34 PDT
Ideally, we would not make any C++ headers WebKit SPI, and then we won't need to worry about InstallAPI here.