[Bug c++/99331] New: -Wconversion false-positive in immidiate context

nok.raven at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Mar 1 18:43:38 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99331

            Bug ID: 99331
           Summary: -Wconversion false-positive in immidiate context
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nok.raven at gmail dot com
  Target Milestone: ---

template <int N> struct X {};
template <class T> X<sizeof(T)> foo();

g++ -Wconversion -Werror src.cpp

<source>:2:22: error: conversion from 'long unsigned int' to 'int' may change
value [-Werror=conversion]
    2 | template <class T> X<sizeof(T)> foo();
      |                      ^~~~~~~~~

https://godbolt.org/z/d16WhG


More information about the Gcc-bugs mailing list