Closed Bug 1397942 Opened 4 years ago Closed 4 years ago

Build failed with MSVC2017 because of warnings like 'nsTString<char16_t>::Find': an out-of-line definition of a member of a class template cannot have default arguments

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: xidorn, Assigned: xidorn)

References

Details

Attachments

(1 file)

> xpcom/string/precompiled_templates.cpp(77): error C2220: warning treated as error - no 'object' file generated
> xpcom/string/precompiled_templates.cpp(77): warning C5037: 'nsTString<char16_t>::Find': an out-of-line definition of a member of a class template cannot have default arguments
> xpcom/string/precompiled_templates.cpp(77): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
> xpcom/string/precompiled_templates.cpp(81): warning C5037: 'nsTString<char16_t>::Find': an out-of-line definition of a member of a class template cannot have default arguments
> xpcom/string/precompiled_templates.cpp(81): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
> xpcom/string/precompiled_templates.cpp(85): warning C5037: 'nsTString<char16_t>::RFind': an out-of-line definition of a member of a class template cannot have default arguments
> xpcom/string/precompiled_templates.cpp(85): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
> xpcom/string/precompiled_templates.cpp(89): warning C5037: 'nsTString<char16_t>::RFind': an out-of-line definition of a member of a class template cannot have default arguments
> xpcom/string/precompiled_templates.cpp(89): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
> xpcom/string/precompiled_templates.cpp(93): warning C5037: 'nsTString<char16_t>::FindCharInSet': an out-of-line definition of a member of a class template cannot have default arguments
> xpcom/string/precompiled_templates.cpp(93): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
> xpcom/string/precompiled_templates.cpp(97): warning C5037: 'nsTString<char>::Compare': an out-of-line definition of a member of a class template cannot have default arguments
> xpcom/string/precompiled_templates.cpp(97): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
> xpcom/string/precompiled_templates.cpp(102): warning C5037: 'nsTString<char16_t>::EqualsIgnoreCase': an out-of-line definition of a member of a class template cannot have default arguments
> xpcom/string/precompiled_templates.cpp(102): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
This seems to be a pretty new warning, introduced in VC2017u1 [1], and it doesn't have lots of document at the moment...

[1] https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warnings-by-compiler-version#warnings-introduced-in-visual-c-2017-update-1
If this is blocking anyone I think just disabling the warning in xpcom/string/moz.build should do the trick. It's a bizarre warning to have, I'm not sure it's legit. Something like the following should suffice:

> if CONFIG['_MSC_VER']:
>     CXXFLAGS += ['-wd5037']
This indeed seems to be a MSVC bug which they may fix in the next release: https://developercommunity.visualstudio.com/content/problem/81223/incorrect-error-c5037-with-permissive.html

It is said that there is no workaround for this issue, unfortunately.
Attachment #8905778 - Flags: review?(mh+mozilla) → review?(nfroyd)
Comment on attachment 8905778 [details]
Bug 1397942 - Disable C5037 in xpcom/string to workaround MSVC bug.

https://reviewboard.mozilla.org/r/177576/#review183440
Attachment #8905778 - Flags: review?(nfroyd) → review+
Pushed by xquan@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/867e6e5787fa
Disable C5037 in xpcom/string to workaround MSVC bug. r=froydnj
https://hg.mozilla.org/mozilla-central/rev/867e6e5787fa
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Assignee: nobody → xidorn+moz
Depends on: 1448472
You need to log in before you can comment on or make changes to this bug.