public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59404] New: declaration shadowing template parameter wrongly accepted
@ 2013-12-06  3:52 sami.liedes at iki dot fi
  2013-12-15 18:45 ` [Bug c++/59404] " daniel.kruegler at googlemail dot com
  0 siblings, 1 reply; 2+ messages in thread
From: sami.liedes at iki dot fi @ 2013-12-06  3:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59404

            Bug ID: 59404
           Summary: declaration shadowing template parameter wrongly
                    accepted
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sami.liedes at iki dot fi

Hi,

This code compiles with gcc -std=c++11 (but is rejected by clang++):

-----
template <typename T>
struct A {
    template<typename T2>
    void f() {
    typedef int T;
    }
};

void g() {
    A<int> a;
    a.f<int>();
}
-----

However if the third line (template<typename T2>) is removed, GCC correctly
rejects the code because typedef int T shadows the template parameter T.

$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc-4.8.real
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.8.2-7'
--with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.2 (Debian 4.8.2-7)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/59404] declaration shadowing template parameter wrongly accepted
  2013-12-06  3:52 [Bug c++/59404] New: declaration shadowing template parameter wrongly accepted sami.liedes at iki dot fi
@ 2013-12-15 18:45 ` daniel.kruegler at googlemail dot com
  0 siblings, 0 replies; 2+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-12-15 18:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59404

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
gcc 4.9.0 HEAD also rejects the code
>From gcc-bugs-return-437650-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Dec 15 18:50:06 2013
Return-Path: <gcc-bugs-return-437650-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 12630 invoked by alias); 15 Dec 2013 18:50:06 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 12579 invoked by uid 48); 15 Dec 2013 18:50:02 -0000
From: "hubicka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/59008] [4.9 Regression] ICEs in try_make_edge_direct_simple_call / propagate_controlled_uses
Date: Sun, 15 Dec 2013 18:50:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: ipa
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hubicka at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P1
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-59008-4-WSuf0D7qDG@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59008-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59008-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-12/txt/msg01305.txt.bz2
Content-length: 433

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY008

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mjambor at suse dot cz

--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Martin, this is refcouting issue in ipa-prop, so "yours" :)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-12-15 18:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-06  3:52 [Bug c++/59404] New: declaration shadowing template parameter wrongly accepted sami.liedes at iki dot fi
2013-12-15 18:45 ` [Bug c++/59404] " daniel.kruegler at googlemail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).