Bug 1323480

Summary: LLVM git fails to compile: constructor required before non-static data member for ‘llvm::ValueEnumerator::MDRange::First’ has been parsed
Product: [Fedora] Fedora Reporter: Vedran Miletić <vedran>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: davejohansen, jakub, jason, jwakely, law, mpolacek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-01 14:11:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Preprocessed source
none
Preprocessed source from GCC 5 none

Description Vedran Miletić 2016-04-03 13:43:53 UTC
In file included from /usr/include/c++/6.0.0/bits/move.h:57:0,
                 from /usr/include/c++/6.0.0/bits/stl_pair.h:59,
                 from /usr/include/c++/6.0.0/utility:70,
                 from /usr/include/c++/6.0.0/algorithm:60,
                 from /home/vedranm/workspace/llvm/include/llvm/ADT/StringRef.h:14,
                 from /home/vedranm/workspace/llvm/include/llvm/ADT/StringMap.h:17,
                 from /home/vedranm/workspace/llvm/include/llvm/Support/Host.h:17,
                 from /home/vedranm/workspace/llvm/include/llvm/ADT/Hashing.h:49,
                 from /home/vedranm/workspace/llvm/include/llvm/ADT/ArrayRef.h:13,
                 from /home/vedranm/workspace/llvm/include/llvm/ADT/DenseMapInfo.h:17,
                 from /home/vedranm/workspace/llvm/include/llvm/ADT/DenseMap.h:17,
                 from /home/vedranm/workspace/llvm/lib/Bitcode/Writer/ValueEnumerator.h:17,
                 from /home/vedranm/workspace/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp:14:
/usr/include/c++/6.0.0/type_traits: In substitution of ‘template<class _Tp, class> static std::true_type std::__do_is_default_constructible_impl::__test(int) [with _Tp = llvm::ValueEnumerator::MDRange; <template-parameter-1-2> = <missing>]’:
/usr/include/c++/6.0.0/type_traits:879:35:   required from ‘struct std::__is_default_constructible_impl<llvm::ValueEnumerator::MDRange>’
/usr/include/c++/6.0.0/type_traits:143:12:   required from ‘struct std::__and_<std::__not_<std::is_void<llvm::ValueEnumerator::MDRange> >, std::__is_default_constructible_impl<llvm::ValueEnumerator::MDRange> >’
/usr/include/c++/6.0.0/type_traits:883:12:   required from ‘struct std::__is_default_constructible_atom<llvm::ValueEnumerator::MDRange>’
/usr/include/c++/6.0.0/type_traits:904:12:   required from ‘struct std::__is_default_constructible_safe<llvm::ValueEnumerator::MDRange, false>’
/usr/include/c++/6.0.0/type_traits:910:12:   required from ‘struct std::is_default_constructible<llvm::ValueEnumerator::MDRange>’
/usr/include/c++/6.0.0/type_traits:143:12:   [ skipping 6 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/c++/6.0.0/type_traits:715:12:   required from ‘struct std::is_abstract<llvm::detail::AlignerImpl<llvm::detail::DenseMapPair<unsigned int, llvm::ValueEnumerator::MDRange> [1], llvm::SmallDenseMap<unsigned int, llvm::ValueEnumerator::MDRange, 1u>::LargeRep, char, char, char, char, char, char, char, char> >’
/home/vedranm/workspace/llvm/include/llvm/Support/AlignOf.h:79:13:   required from ‘constexpr const unsigned int llvm::AlignOf<llvm::detail::AlignerImpl<llvm::detail::DenseMapPair<unsigned int, llvm::ValueEnumerator::MDRange> [1], llvm::SmallDenseMap<unsigned int, llvm::ValueEnumerator::MDRange, 1u>::LargeRep, char, char, char, char, char, char, char, char> >::Alignment’
/home/vedranm/workspace/llvm/include/llvm/Support/AlignOf.h:86:52:   required from ‘struct llvm::AlignOf<llvm::detail::AlignerImpl<llvm::detail::DenseMapPair<unsigned int, llvm::ValueEnumerator::MDRange> [1], llvm::SmallDenseMap<unsigned int, llvm::ValueEnumerator::MDRange, 1u>::LargeRep, char, char, char, char, char, char, char, char> >’
/home/vedranm/workspace/llvm/include/llvm/Support/AlignOf.h:251:8:   required from ‘struct llvm::AlignedCharArrayUnion<llvm::detail::DenseMapPair<unsigned int, llvm::ValueEnumerator::MDRange> [1], llvm::SmallDenseMap<unsigned int, llvm::ValueEnumerator::MDRange, 1u>::LargeRep, char, char, char, char, char, char, char, char>’
/home/vedranm/workspace/llvm/include/llvm/ADT/DenseMap.h:759:59:   required from ‘class llvm::SmallDenseMap<unsigned int, llvm::ValueEnumerator::MDRange, 1u>’
/home/vedranm/workspace/llvm/lib/Bitcode/Writer/ValueEnumerator.h:100:39:   required from here
/usr/include/c++/6.0.0/type_traits:868:48: error: constructor required before non-static data member for ‘llvm::ValueEnumerator::MDRange::First’ has been parsed
     template<typename _Tp, typename = decltype(_Tp())>
                                                ^~~~~
/usr/include/c++/6.0.0/type_traits:868:48: error: constructor required before non-static data member for ‘llvm::ValueEnumerator::MDRange::Last’ has been parsed
/usr/include/c++/6.0.0/type_traits:868:48: error: constructor required before non-static data member for ‘llvm::ValueEnumerator::MDRange::NumStrings’ has been parsed
lib/Bitcode/Writer/CMakeFiles/LLVMBitWriter.dir/build.make:134: recipe for target 'lib/Bitcode/Writer/CMakeFiles/LLVMBitWriter.dir/ValueEnumerator.cpp.o' failed
make[2]: *** [lib/Bitcode/Writer/CMakeFiles/LLVMBitWriter.dir/ValueEnumerator.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /usr/include/c++/6.0.0/bits/move.h:57:0,
                 from /usr/include/c++/6.0.0/bits/stl_pair.h:59,
                 from /usr/include/c++/6.0.0/utility:70,
                 from /usr/include/c++/6.0.0/algorithm:60,
                 from /home/vedranm/workspace/llvm/include/llvm/ADT/StringRef.h:14,
                 from /home/vedranm/workspace/llvm/include/llvm/ADT/StringMap.h:17,
                 from /home/vedranm/workspace/llvm/include/llvm/Support/Host.h:17,
                 from /home/vedranm/workspace/llvm/include/llvm/ADT/Hashing.h:49,
                 from /home/vedranm/workspace/llvm/include/llvm/ADT/ArrayRef.h:13,
                 from /home/vedranm/workspace/llvm/include/llvm/ADT/DenseMapInfo.h:17,
                 from /home/vedranm/workspace/llvm/include/llvm/ADT/DenseMap.h:17,
                 from /home/vedranm/workspace/llvm/lib/Bitcode/Writer/ValueEnumerator.h:17,
                 from /home/vedranm/workspace/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:14:
/usr/include/c++/6.0.0/type_traits: In substitution of ‘template<class _Tp, class> static std::true_type std::__do_is_default_constructible_impl::__test(int) [with _Tp = llvm::ValueEnumerator::MDRange; <template-parameter-1-2> = <missing>]’:
/usr/include/c++/6.0.0/type_traits:879:35:   required from ‘struct std::__is_default_constructible_impl<llvm::ValueEnumerator::MDRange>’
/usr/include/c++/6.0.0/type_traits:143:12:   required from ‘struct std::__and_<std::__not_<std::is_void<llvm::ValueEnumerator::MDRange> >, std::__is_default_constructible_impl<llvm::ValueEnumerator::MDRange> >’
/usr/include/c++/6.0.0/type_traits:883:12:   required from ‘struct std::__is_default_constructible_atom<llvm::ValueEnumerator::MDRange>’
/usr/include/c++/6.0.0/type_traits:904:12:   required from ‘struct std::__is_default_constructible_safe<llvm::ValueEnumerator::MDRange, false>’
/usr/include/c++/6.0.0/type_traits:910:12:   required from ‘struct std::is_default_constructible<llvm::ValueEnumerator::MDRange>’
/usr/include/c++/6.0.0/type_traits:143:12:   [ skipping 6 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/c++/6.0.0/type_traits:715:12:   required from ‘struct std::is_abstract<llvm::detail::AlignerImpl<llvm::detail::DenseMapPair<unsigned int, llvm::ValueEnumerator::MDRange> [1], llvm::SmallDenseMap<unsigned int, llvm::ValueEnumerator::MDRange, 1u>::LargeRep, char, char, char, char, char, char, char, char> >’
/home/vedranm/workspace/llvm/include/llvm/Support/AlignOf.h:79:13:   required from ‘constexpr const unsigned int llvm::AlignOf<llvm::detail::AlignerImpl<llvm::detail::DenseMapPair<unsigned int, llvm::ValueEnumerator::MDRange> [1], llvm::SmallDenseMap<unsigned int, llvm::ValueEnumerator::MDRange, 1u>::LargeRep, char, char, char, char, char, char, char, char> >::Alignment’
/home/vedranm/workspace/llvm/include/llvm/Support/AlignOf.h:86:52:   required from ‘struct llvm::AlignOf<llvm::detail::AlignerImpl<llvm::detail::DenseMapPair<unsigned int, llvm::ValueEnumerator::MDRange> [1], llvm::SmallDenseMap<unsigned int, llvm::ValueEnumerator::MDRange, 1u>::LargeRep, char, char, char, char, char, char, char, char> >’
/home/vedranm/workspace/llvm/include/llvm/Support/AlignOf.h:251:8:   required from ‘struct llvm::AlignedCharArrayUnion<llvm::detail::DenseMapPair<unsigned int, llvm::ValueEnumerator::MDRange> [1], llvm::SmallDenseMap<unsigned int, llvm::ValueEnumerator::MDRange, 1u>::LargeRep, char, char, char, char, char, char, char, char>’
/home/vedranm/workspace/llvm/include/llvm/ADT/DenseMap.h:759:59:   required from ‘class llvm::SmallDenseMap<unsigned int, llvm::ValueEnumerator::MDRange, 1u>’
/home/vedranm/workspace/llvm/lib/Bitcode/Writer/ValueEnumerator.h:100:39:   required from here
/usr/include/c++/6.0.0/type_traits:868:48: error: constructor required before non-static data member for ‘llvm::ValueEnumerator::MDRange::First’ has been parsed
     template<typename _Tp, typename = decltype(_Tp())>
                                                ^~~~~
/usr/include/c++/6.0.0/type_traits:868:48: error: constructor required before non-static data member for ‘llvm::ValueEnumerator::MDRange::Last’ has been parsed
/usr/include/c++/6.0.0/type_traits:868:48: error: constructor required before non-static data member for ‘llvm::ValueEnumerator::MDRange::NumStrings’ has been parsed
lib/Bitcode/Writer/CMakeFiles/LLVMBitWriter.dir/build.make:86: recipe for target 'lib/Bitcode/Writer/CMakeFiles/LLVMBitWriter.dir/BitcodeWriter.cpp.o' failed
make[2]: *** [lib/Bitcode/Writer/CMakeFiles/LLVMBitWriter.dir/BitcodeWriter.cpp.o] Error 1
CMakeFiles/Makefile2:1528: recipe for target 'lib/Bitcode/Writer/CMakeFiles/LLVMBitWriter.dir/all' failed
make[1]: *** [lib/Bitcode/Writer/CMakeFiles/LLVMBitWriter.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2

Changing MDRange() = default; to MDRange() {} fixes the compile [1]. According to my understanding of [2], the two should be equivalent.

[1] http://reviews.llvm.org/D18730
[2] http://en.cppreference.com/w/cpp/language/default_constructor

Comment 1 Jakub Jelinek 2016-04-03 17:16:24 UTC
Please attach preprocessed source and g++ command line that can be used to reproduce this.

Comment 2 Vedran Miletić 2016-04-03 20:18:30 UTC
Created attachment 1143108 [details]
Preprocessed source

/usr/bin/c++ -fPIC -fvisibility-inlines-hidden -save-temps -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -std=c++11 -g -fPIC -fno-exceptions -fno-rtti -c -o CMakeFiles/LLVMBitWriter.dir/BitcodeWriter.cpp.o /home/vedranm/workspace/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

Comment 3 Jakub Jelinek 2016-04-03 21:04:09 UTC
Maybe a variation of http://gcc.gnu.org/PR58328 that has been resolved as clang bug?  In PR58328 there is following testcase without B() = default; :
struct A {
  struct B {
    int x, y = 1;
    B() = default;
  };
  A(const B& opts = B()) {}
};
I haven't tried to delta reduce this source, but I bet it is similar to the above with B() = default;, at least it is during eh spec processing of some default argument, and the above is accepted by clang++ 3.8 like the PR58328 testcase, and rejected by both g++ 5.x and 6.0.

Comment 4 Vedran Miletić 2016-04-03 21:41:20 UTC
Not the same thing unfortunately, LLVM git compiles fine with GCC 5 on Fedora 23.

Comment 5 Jakub Jelinek 2016-04-04 07:28:20 UTC
The provided preprocessed source fails to compile with GCC 5 though.
So, perhaps something in the headers changed too?  You could also attach the same source file preprocessed with GCC 5.
Anyway, I'll let our C++ folks comment on whether the #c3 testcase is rightly rejected or not.

Comment 6 Vedran Miletić 2016-04-04 20:30:49 UTC
Created attachment 1143445 [details]
Preprocessed source from GCC 5

Comment 7 Vedran Miletić 2016-05-01 14:11:39 UTC
Fixed in GCC 6.1.1 http://koji.fedoraproject.org/koji/buildinfo?buildID=758112