[LLVMbugs] [Bug 15371] New: Behavior of "using" statement with template inheritance does not work as expected and differs from gcc.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 26 19:34:45 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15371

            Bug ID: 15371
           Summary: Behavior of "using" statement with template
                    inheritance does not work as expected and differs from
                    gcc.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jmunxsys at yahoo.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 10092
  --> http://llvm.org/bugs/attachment.cgi?id=10092&action=edit
C++ file that shows the issue.

I have attached a file that compiles with GCC, but not clang. I'm not sure this
is a problem, but it's not the behavior I expected. 

I don't expect to need "PACIFY_CLANG" defined because of the using statement,
and I'd expect that the gcc version would work again because of the using
statement at the beginning of Derived.


Below is the behavior I'm seeing: 

LaptopBSD> /Storage/scratch/tools/bin/clang++ -v
clang version 3.3 (trunk 176074)
Target: x86_64-unknown-freebsd9.0
Thread model: posix
LaptopBSD> /Storage/scratch/tools/bin/clang++ -c test.cc
test.cc:38:13: error: out-of-line definition of 'Derived::get_ptr' differs from
      the declaration in the return type
Derived<A>::get_ptr() const 
            ^
test.cc:26:7: note: previous declaration is here
    * get_ptr() const;
      ^
1 error generated.
LaptopBSD> /Storage/scratch/tools/bin/clang++ -DPACIFY_CLANG_ANGER_GCC=1 -c
test.cc
LaptopBSD> /Storage/scratch/tools/bin/clang++ -DPACIFY_CLANG=1 -c test.cc
LaptopBSD> /usr/local/bin/g++48 -DPACIFY_CLANG=1 -c test.cc
LaptopBSD> /usr/local/bin/g++48 -DPACIFY_CLANG_ANGER_GCC=1 -c test.cc
test.cc:38:1: error: prototype for 'const typename Derived<A>::Data*
Derived<A>::get_ptr() const' does not match any in class 'Derived<A>'
 Derived<A>::get_ptr() const 
 ^
test.cc:26:7: error: candidate is: const typename Base<A>::Data*
Derived<A>::get_ptr() const
     * get_ptr() const;
       ^
LaptopBSD> /usr/local/bin/g++48 -v
Using built-in specs.
COLLECT_GCC=/usr/local/bin/g++48
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc48/gcc/x86_64-portbld-freebsd9.0/4.8.0/lto-wrapper
Target: x86_64-portbld-freebsd9.0
Configured with: ./../gcc-4.8-20130113/configure --disable-nls
--libdir=/usr/local/lib/gcc48 --libexecdir=/usr/local/libexec/gcc48
--program-suffix=48 --with-as=/usr/local/bin/as --with-gmp=/usr/local
--with-gxx-include-dir=/usr/local/lib/gcc48/include/c++/
--with-ld=/usr/local/bin/ld --with-libiconv-prefix=/usr/local
--with-pkgversion='FreeBSD Ports Collection' --with-system-zlib
--disable-libgcj --enable-languages=c,c++,objc,fortran --prefix=/usr/local
--mandir=/usr/local/man --infodir=/usr/local/info/gcc48
--build=x86_64-portbld-freebsd9.0
Thread model: posix
gcc version 4.8.0 20130113 (experimental) (FreeBSD Ports Collection)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130227/6f27afb9/attachment.html>


More information about the llvm-bugs mailing list