On 2014.06.26 at 14:06 +0100, Jonathan Wakely wrote: > DR1579 relaxes [class.copy]/32 so that expressions in return > statements can be looked up as rvalues even when they aren't the same > type as the function return type. > > Implementing that seems as simple as removing the restriction on the > types. Tested x86_64-linux, no regressions.
This patch cause yet another LLVM build error: FAILED: /var/tmp/gcc_test/usr/local/bin/g++ -DCLANG_ENABLE_ARCMT -DCLANG_ENABLE_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DclangFrontend_EXPORTS -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wnon-virtual-dtor -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -O2 -DNDEBUG -pipe -fPIC -Itools/clang/lib/Frontend -I/var/tmp/llvm-project/llvm/tools/clang/lib/Frontend -I/var/tmp/llvm-project/llvm/tools/clang/include -Itools/clang/include -Iinclude -I/var/tmp/llvm-project/llvm/include -fno-exceptions -fno-rtti -MMD -MT tools/clang/lib/Frontend/CMakeFiles/clangFrontend.dir/CompilerInvocation.cpp.o -MF "tools/clang/lib/Frontend/CMakeFiles/clangFrontend.dir/CompilerInvocation.cpp.o.d" -o tools/clang/lib/Frontend/CMakeFiles/clangFrontend.dir/CompilerInvocation.cpp.o -c /var/tmp/llvm-project/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp In file included from /var/tmp/llvm-project/llvm/tools/clang/include/clang/Basic/DiagnosticOptions.h:14:0, from /var/tmp/llvm-project/llvm/tools/clang/include/clang/Frontend/CompilerInvocation.h:13, from /var/tmp/llvm-project/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp:10: /var/tmp/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘llvm::IntrusiveRefCntPtr<T>::IntrusiveRefCntPtr(llvm::IntrusiveRefCntPtr<X>&&) [with X = clang::vfs::OverlayFileSystem; T = clang::vfs::FileSystem]’: /var/tmp/llvm-project/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp:2047:10: required from here /var/tmp/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:137:8: error: ‘clang::vfs::OverlayFileSystem* llvm::IntrusiveRefCntPtr<clang::vfs::OverlayFileSystem>::Obj’ is private T* Obj; ^ /var/tmp/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:158:13: error: within this context S.Obj = 0; ^ Reduced: markus@x4 llvm_build % cat CompilerInvocation.ii template <typename T> class A { T Obj; public: T element_type; A (T *); template <class X> A (A<X> &&p1) { p1.Obj; } template <class X> A (A<X> &); }; class B { public: B (A<int>); }; A<int> fn1 () { A<B> a (new B (0)); return a; } markus@x4 llvm_build % /var/tmp/gcc_test/usr/local/bin/g++ -c -std=c++11 CompilerInvocation.ii CompilerInvocation.ii: In instantiation of ‘A<T>::A(A<X>&&) [with X = B; T = int]’: CompilerInvocation.ii:20:10: required from here CompilerInvocation.ii:3:5: error: ‘B A<B>::Obj’ is private T Obj; ^ CompilerInvocation.ii:8:38: error: within this context template <class X> A (A<X> &&p1) { p1.Obj; } ^ -- Markus
template <typename T> class A { T Obj; public: T element_type; A (T *); template <class X> A (A<X> &&p1) { p1.Obj; } template <class X> A (A<X> &); }; class B { public: B (A<int>); }; A<int> fn1 () { A<B> a (new B (0)); return a; }