public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61937] New: Misleading errors due to constructor template deducing argument as void
@ 2014-07-28 17:24 redi at gcc dot gnu.org
2014-12-14 0:46 ` [Bug c++/61937] " ville.voutilainen at gmail dot com
0 siblings, 1 reply; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2014-07-28 17:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61937
Bug ID: 61937
Summary: Misleading errors due to constructor template deducing
argument as void
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: minor
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
template<typename T, typename U = void>
struct trait;
template<typename T>
struct trait<T, T>
{
using type = T;
};
template<typename T>
struct trait<T, void>
{
using type = T;
};
struct S {
template<typename T, typename U = typename trait<T>::type>
S(const T&) { }
};
void f() { }
S s = f();
Compiling with -std=c++11 gives four errors:
void.cc: In substitution of ‘template<class T, class U> S::S(const T&) [with T
= void; U = <missing>]’:
void.cc:23:9: required from here
void.cc:17:24: error: ambiguous class template instantiation for ‘struct
trait<void, void>’
template<typename T, typename U = typename trait<T>::type>
^
void.cc:5:10: error: candidates are: struct trait<T, T>
struct trait<T, T>
^
void.cc:11:10: error: struct trait<T, void>
struct trait<T, void>
^
void.cc:23:9: error: conversion from ‘void’ to non-scalar type ‘S’ requested
S s = f();
^
Only the last one is relevant and useful, the others are just confusing.
The first three errors are due to instantiating the constructor template with T
= void but that doesn't make much sense. It implies the function f() returns an
object of type void, rather than returning nothing.
>From gcc-bugs-return-457269-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jul 28 19:11:59 2014
Return-Path: <gcc-bugs-return-457269-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 22151 invoked by alias); 28 Jul 2014 19:11:58 -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 22064 invoked by uid 48); 28 Jul 2014 19:11:52 -0000
From: "harmeeksingh at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/61938] New: Vectorization not happening .
Date: Mon, 28 Jul 2014 19:11:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: harmeeksingh at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-61938-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: 2014-07/txt/msg01860.txt.bz2
Content-length: 2427
https://gcc.gnu.org/bugzilla/show_bug.cgi?ida938
Bug ID: 61938
Summary: Vectorization not happening .
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: harmeeksingh at gmail dot com
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.7.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --disable-build-with-cxx
--disable-build-poststage1-with-cxx --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin
--enable-initfini-array --enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) (GCC)
Testcase
#include <stdio.h>
#define VEC 1024
typedef long int int64;
typedef int int32;
void foo (int arraysize,
int *result,
int *selectvector,
int selectelements,
int32 *array,
int32 compval)
{
int k, i;
for (k =0,i=0; i < selectelements; ++i) {
result[k] = selectvector[i]; k += (((array[selectvector[i]])) =compval);
}
}
main()
{
int result[VEC];
int selectvector[VEC];
int selectelements;
int32 array[VEC];
int k, i;
foo(VEC, &result[0], &selectvector[0], VEC, &array[0], 1);
}
Compilation log
gcc -fPIC -ggdb -O3 -march=native -ftree-vectorize -ftree-vectorizer-verbose=7
/tmp/x.c -o /tmp/x
Analyzing loop at /tmp/x.c:17
17: not vectorized: data ref analysis failed *D.2502_9 = D.2506_14;
17: not vectorized: data ref analysis failed *D.2502_9 = D.2506_14;
/tmp/x.c:9: note: vectorized 0 loops in function.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/61937] Misleading errors due to constructor template deducing argument as void
2014-07-28 17:24 [Bug c++/61937] New: Misleading errors due to constructor template deducing argument as void redi at gcc dot gnu.org
@ 2014-12-14 0:46 ` ville.voutilainen at gmail dot com
0 siblings, 0 replies; 2+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-14 0:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61937
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-12-14
CC| |ville.voutilainen at gmail dot com
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-14 0:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-28 17:24 [Bug c++/61937] New: Misleading errors due to constructor template deducing argument as void redi at gcc dot gnu.org
2014-12-14 0:46 ` [Bug c++/61937] " ville.voutilainen at gmail 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).