Skip to content
This repository has been archived by the owner on Oct 9, 2019. It is now read-only.

Fix compile error: Use explicit conversion of unique_ptr to bool #238

Open
wants to merge 1 commit into
base: khronos/spirv-3.6.1
Choose a base branch
from

Conversation

mfwitten
Copy link

The aging LLVM code is converting an object of type unique_ptr to
an object of type bool; this is being done implicitly, thereby
causing a compile-time error with a modern, standards-compliant
compiler.

This is explained well here:

https://github.com/microsoft/DirectXShaderCompiler/issues/1692

In particular:

The C++ standard specifies operator bool on unique_ptr as being
explicit, so this is clearly a bug in the LLVM source code:
https://en.cppreference.com/w/cpp/memory/unique_ptr/operator_bool

This commit merely makes the conversion explicit, allowing the code
to be built by GCC version 9.1.0.

This bug was fixed by the LLVM project proper as part of the
following commit:

69341e6abca92f7f118ee7bd99be0cdfc649386f
2016-04-08
https://github.com/llvm/llvm-project/commit/69341e6abca92f7f118ee7bd99be0cdfc649386f

The aging LLVM code is converting  an object of type `unique_ptr` to
an object  of type  `bool`; this is  being done  implicitly, thereby
causing  a compile-time  error  with  a modern,  standards-compliant
compiler.

This is explained well here:

    microsoft/DirectXShaderCompiler#1692

In particular:

> The C++  standard specifies operator  bool on unique_ptr  as being
> explicit,  so this  is  clearly a  bug in  the  LLVM source  code:
> https://en.cppreference.com/w/cpp/memory/unique_ptr/operator_bool

This commit merely makes the  conversion explicit, allowing the code
to be built by GCC version 9.1.0.

This  bug was  fixed  by the  LLVM  project proper  as  part of  the
following commit:

    69341e6abca92f7f118ee7bd99be0cdfc649386f
    2016-04-08
    llvm/llvm-project@69341e6
@mfwitten
Copy link
Author

Really, the LLVM base for this project should be updated.
In the meantime, this commit keeps things working.

@bader
Copy link
Contributor

bader commented Sep 21, 2019

@mfwitten, active development of this tool/library has moved to https://github.com/KhronosGroup/SPIRV-LLVM-Translator.
This repo is not maintained anymore, AFAIK.

@mfwitten
Copy link
Author

Isn't it against the CoC to waste everybody's fscking time? Fix your links/website, you goofballs.

@pierremoreau
Copy link
Contributor

@bader Do you know who could answer whether this is still maintained, maybe bring it up on the tooling call?

If it is no longer maintained, the README and/or description should be updated to say so (and point to SPIRV-LLVM-Translator), and the repo archived, imho.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants