[Bug c++/56299] New: Dependent lambda expression breaks explicit template instantiation
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56299 Bug #: 56299 Summary: Dependent lambda expression breaks explicit template instantiation Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ers.tr...@gmail.com The following code produces an internal compiler error: template class Foo { void process(Foo m); void bar() { [this] { process(Foo()); }(); } }; template class Foo; Output: foo.cpp: In lambda function: foo.cpp:11:24: internal compiler error: in get_expr_operands, at tree-ssa-operands.c:1035 Please submit a full bug report, with preprocessed source if appropriate. Compiler info: Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /build/src/gcc-4.7.2/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --enable-libstdcxx-time --enable-gnu-unique-object --enable-linker-build-id --with-ppl --enable-cloog-backend=isl --disable-ppl-version-check --disable-cloog-version-check --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu --disable-multilib --disable-libssp --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-checking=release Thread model: posix gcc version 4.7.2 (GCC)
[Bug c++/70413] New: Class template names in anonymous namespaces are not globally unique
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70413 Bug ID: 70413 Summary: Class template names in anonymous namespaces are not globally unique Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ers.trion at gmail dot com Target Milestone: --- Created attachment 38099 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38099&action=edit Example Source Code If a class template is defined twice with the same name inside of anonymous namespaces in different translation units and then used as a template template parameter, the two templates are not treated as having globally unique names. Example: invoke.hh: #include void invoke_foo(), invoke_bar(); template class T> void invoke_print() { T<0>{}.print(); } foo.cc: #include "invoke.hh" namespace { template struct s { void print() { std::cout << "foo\n"; } }; } void invoke_foo() { invoke_print(); } bar.cc: #include "invoke.hh" namespace { template struct s { void print() { std::cout << "bar\n"; } }; } void invoke_bar() { invoke_print(); } main.cc: #include "invoke.hh" int main() { invoke_foo(); invoke_bar(); } Compile with g++ -obug main.cc foo.cc bar.cc -std=c++11 Expected output: foo bar Actual output: foo foo Tested with GCC 5.3.0 on x86_64. Clang 3.7.1 gets this right. The source files are attached.
[Bug c++/113052] New: Templated conversion operator of templated class is not considered in argument to equality operator
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113052 Bug ID: 113052 Summary: Templated conversion operator of templated class is not considered in argument to equality operator Product: gcc Version: 13.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ers.trion at gmail dot com Target Milestone: --- See https://godbolt.org/z/fWKfEj7zb . template struct accessor { template operator T() const; }; void foo() { accessor acc; (void) (acc == 10); } reports : In function 'void foo()': :9:21: error: no match for 'operator==' (operand types are 'accessor' and 'int') 9 | (void) (acc == 10); | ~~~ ^~ ~~ | | | | | int | accessor , but the code should be accepted (as Clang does). To trigger this bug it is necessary: - that the struct is templated - that the conversion operator return the template-argument type of the class - that the operator is templated as well (this was reduced from an enable_if) Possibly related: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89580 - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85250
[Bug c++/94894] avoidable instantiation of conversion function template during overload resolution
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94894 Fabian Knorr changed: What|Removed |Added CC||ers.trion at gmail dot com --- Comment #4 from Fabian Knorr --- Not resolved: The patch fixes the tests from Comment 1, but code in the OP remains broken. Here's another reproducer: template struct restrictive { static_assert(Dims != 0); }; template struct permissive { operator restrictive() const; }; struct unrelated {}; void fun(unrelated) {} void fun(permissive<0>) {} int main() { fun(permissive<0>{}); } x86_64 gcc 14.2: : In instantiation of 'struct restrictive<0>': :18:8: required from here 18 | fun(permissive<0>{}); | ~~~^ :3:24: error: static assertion failed 3 | static_assert(Dims != 0); | ~^~~~ :3:24: note: the comparison reduces to '(0 != 0)'