[Bug c++/67468] New: compiler changes template argument
cas43 at cs dot stanford.edu
gcc-bugzilla@gcc.gnu.org
Sun Sep 6 19:52:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67468
Bug ID: 67468
Summary: compiler changes template argument
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: cas43 at cs dot stanford.edu
Target Milestone: ---
When compiled with:
g++ -c prog.cpp -Q
The compiler output contains "B<A<S>::x>" but the input contains "B<A<R>::x>".
The compiler has replaced the template argument R with the template argument S.
CODE:
template<class T> struct A
{
const static int x=0;
};
template<int d> struct B;
template<class R,class S> class C
{
const static int x=A<R>::x<A<S>::x?A<R>::x:A<S>::x;
};
template<class T,class R,class S> int Get_Block_At_Mask(const C<R,S>&
c,B<A<R>::x>* b)
{
return 0;
}
COMPILER OUTPUT:
int Get_Block_At_Mask(const C<R, S>&, B<A<S>::x>*)
Analyzing compilation unit
Performing interprocedural optimizations
<*free_lang_data> <visibility> <build_ssa_passes> <opt_local_passes>
<free-inline-summary> <whole-program> <inline>Assembling functions:
Execution times (seconds)
phase setup : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.01 (100%) wall
1381 kB (80%) ggc
TOTAL : 0.00 0.00 0.01
1734 kB
Extra diagnostic checks enabled; compiler may run slowly.
Configure with --enable-checking=release to disable checks.
COMPILER VERSIONS TESTED:
Using built-in specs.
COLLECT_GCC=/home/craig/new-gcc/i-trunk/bin/g++
COLLECT_LTO_WRAPPER=/home/craig/new-gcc/i-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../s-trunk/configure --prefix=/home/craig/new-gcc/i-trunk
Thread model: posix
gcc version 6.0.0 20150906 (experimental) (GCC)
-- and --
g++-5 (Ubuntu 5.1.0-0ubuntu11~14.04.1) 5.1.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
More information about the Gcc-bugs
mailing list