Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual Studio build issue #1730

Closed
egorpugin opened this issue May 25, 2019 · 11 comments
Closed

Visual Studio build issue #1730

egorpugin opened this issue May 25, 2019 · 11 comments
Labels
ci Continuous Integration

Comments

@egorpugin
Copy link
Contributor

egorpugin commented May 25, 2019

Using hb2.5.0 I see following error.

When executing: "[behdad.harfbuzz-2.5.0]/src/hb-ot-layout.cc"
D:\temp\29\.sw\src\aa5dc3ae8830\harfbuzz-2.5.0\src\hb-algs.hh(839): error C2440: 'return': cannot convert from 'hb_partial_t<2,Appl,V>' to 'hb_partial_t<2,Appl,V>'
        with
        [
            Appl=const <unnamed-type-hb_add> *,
            V=const OT::RuleSet *
        ]
        and
        [
            Appl=const <unnamed-type-hb_add> *const ,
            V=const OT::RuleSet *
        ]
D:\temp\29\.sw\src\aa5dc3ae8830\harfbuzz-2.5.0\src\hb-algs.hh(839): note: No constructor could take the source type, or constructor overload resolution was ambiguous
D:\temp\29\.sw\src\aa5dc3ae8830\harfbuzz-2.5.0\src\hb-ot-layout-gsubgpos.hh(1374): note: see reference to function template instantiation 'hb_partial_t<2,Appl,V> <unnamed-type-hb_add>::operator ()<const OT::RuleSet*>(_T &&) const' being compiled
        with
        [
            Appl=const <unnamed-type-hb_add> *const ,
            V=const OT::RuleSet *,
            _T=const OT::RuleSet *
        ]

There are tons of these errors from many source files.

Do you test VS2019? I use custom build, so it might be only my issue.
Or it could be VS issue.

@behdad
Copy link
Member

behdad commented May 25, 2019

I'm fairly sure it's VS2019 issue. That's really unfortunate. We have VS bots, but much older than 2019. We also have a dozen other bots. gcc 4.8 has a similar issue with that piece of code, but gcc 4.9+, multiple clang versions, one MSVC version, and at least another compiler are all happy with it. I also reviewed the code and the error doesn't make sense.

@egorpugin
Copy link
Contributor Author

@ebraminio
Copy link
Collaborator

We can dedicate a bot to VS2019 but now that it is broken lets see what Microsoft thinks about it https://developercommunity.visualstudio.com/comments/584497/view.html Thanks for filing the bug and reporting to Microsoft also.

@behdad
Copy link
Member

behdad commented May 27, 2019

VS2019 bot would be great.

For those reading this, the reason I think this is a compiler issue is that the relevant code uses decltype to return, so the error doesn't make sense. What the error means is that decltype returned a type different from the type that returning the same expression from the function is deemed to have.

@ebraminio
Copy link
Collaborator

ebraminio commented May 28, 2019

@ebraminio
Copy link
Collaborator

2013 is also broken https://ci.appveyor.com/project/harfbuzz/harfbuzz/builds/24877151/job/2yt5d21fv4cww4t6 and the only MSVC which is not broken is apparently 2015 which was on our CI :)

@egorpugin
Copy link
Contributor Author

Maybe it's worth it not to hide these errors and turn on VS2017 build bots back?
And probably it's possible to workaround the issue for VS.

@behdad
Copy link
Member

behdad commented May 30, 2019

Orvid King provided me the following extremely hacky patch that seems to at least make it compile:

diff --git a/src/hb-algs.hh b/src/hb-algs.hh
index 007db9e4..2bd86b3b 100644
--- a/src/hb-algs.hh
+++ b/src/hb-algs.hh
@@ -167,10 +167,18 @@ template <unsigned Pos=1, typename Appl, typename V>
 auto hb_partial (Appl&& a, V&& v) HB_AUTO_RETURN
 (( hb_partial_t<Pos, Appl, V> (a, v) ))
 
+#if _MSC_VER
+#define HB_PARTIALIZE(Pos)                         \
+  template <typename _T>                           \
+  decltype(auto) operator() (_T &&_v) const { \
+      hb_partial<Pos> (this, hb_forward<_T> (_v)) \
+  } static_assert (true, "")
+#else
 #define HB_PARTIALIZE(Pos) \
   template <typename _T> \
   auto operator () (_T&& _v) const HB_AUTO_RETURN (hb_partial<Pos> (this, hb_forward<_T> (_v))) \
   static_assert (true, "")
+#endif
 
 
 struct

@behdad behdad changed the title VS2019 build issue Visual Studio build issue May 30, 2019
behdad added a commit that referenced this issue Jun 1, 2019
Hopefully fixes #1730
behdad added a commit that referenced this issue Jun 1, 2019
behdad added a commit that referenced this issue Jun 1, 2019
behdad added a commit that referenced this issue Jun 1, 2019
@behdad behdad closed this as completed in 5a1b5c0 Jun 1, 2019
behdad added a commit that referenced this issue Jun 1, 2019
behdad added a commit that referenced this issue Jun 1, 2019
behdad added a commit that referenced this issue Jun 1, 2019
@behdad
Copy link
Member

behdad commented Jun 1, 2019

Okay committed Orvid's solution.

@ebraminio
Copy link
Collaborator

Coool!

@egorpugin
Copy link
Contributor Author

Thank you!
Works for me.

@khaledhosny khaledhosny added the ci Continuous Integration label Dec 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous Integration
Projects
None yet
Development

No branches or pull requests

4 participants